Black and Scholes d1 derivation I viewed this derivation on the website and didn't understand the variable substitution made in order to find d1 in the calculus (line 6):
\begin{align*}
F(t,s) & = e^{-r(T-t)}\int^\infty_{-\infty} \max\left[se^z-K,0\right]f(z)\,dz \\
\,\, & = e^{-r(T-t)}\left(\int^{\ln \frac{K}{s}}_{-\infty} 0\cdot f(z)\,dz + \int^{\infty}_{\ln\frac{K}{s}} \left(se^z-K\right)\,f(z)\,dz\right) \\
\,\, & = e^{-r(T-t)}\int^{\infty}_{\ln\frac{K}{s}}\left(se^z-K\right)\,f(z)\,dz \\
\,\, & = e^{-r(T-t)} \left(s\int^{\infty}_{\ln\frac{K}{s}} e^zf(z)\,dz -K\int^{\infty}_{\ln\frac{K}{s}}f(z)\,dz \right) \\
\,\, & = e^{-r(T-t)} \left(s\int^{\infty}_{\ln\frac{K}{s}} e^zf(z)\,dz -K\int^{\infty}_{\ln\frac{K}{s}}f(z)\,dz \right) \\
\,\, & = \frac{e^{-r(T-t)}}{\sqrt{2\pi}} \left(s\int^{\infty}_{\ln\frac{K}{s}}  e^{\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right) + \sigma\sqrt{T-t}y}e^{-\frac{y^2}{2}}\,dy -K\int^{\infty}_{\ln\frac{K}{s}}e^{-\frac{z^2}{2}}\,dz \right)  \\
\,\, & = \frac{e^{-r(T-t)}}{\sqrt{2\pi}} \left(s\int^{\infty}_{\ln\frac{K}{s}} e^{\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right) + \sigma\sqrt{T-t}y-\frac{y^2}{2}}\,dy\right) -Ke^{-r(T-t)}\Phi\left(-\frac{\ln\frac{K}{s}- \left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & = \frac{e^{-r(T-t)}}{\sqrt{2\pi}}  e^{\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}\left(s\int^{\infty}_{\ln\frac{K}{s}} e^{\sigma\sqrt{T-t}y-\frac{y^2}{2}}\,dy\right) -Ke^{-r(T-t)}\Phi\left(-\frac{\ln\frac{K}{s}- \left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & =    \frac{e^{-\frac{\sigma^2}{2}\left(T-t\right)}}{\sqrt{2\pi}}  \left(s\int^{\infty}_{\ln\frac{K}{s}} e^{-\frac{1}{2}\left(y^2-2\sigma\sqrt{T-t} y+\sigma^2\left(T-t\right)\right)}e^{\frac{1}{2}\sigma^2\left(T-t\right)}\,dy\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & = \frac{e^{-\frac{\sigma^2}{2}\left(T-t\right)}}{\sqrt{2\pi}}   \left(s\int^{\infty}_{\ln\frac{K}{s}} e^{-\frac{1}{2}\left(y-\sigma\sqrt{T-t}\right)^2+\frac{1}{2}\sigma^2\left(T-t\right)}\,dz\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & = \frac{e^{-\frac{\sigma^2}{2}\left(T-t\right)}e^{\frac{\sigma^2}{2}\left(T-t\right)}}{\sqrt{2\pi}}   \left(s\int^{\infty}_{\ln\frac{K}{s}} e^{-\frac{1}{2}\left(y-\sigma\sqrt{T-t}\right)^2}\,dz\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\ & = \frac{1}{\sqrt{2\pi}}   \left(s\int^{\infty}_{\ln\frac{K}{s}} e^{-\frac{1}{2}\left(y-\sigma\sqrt{T-t}\right)^2}\,dz\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & = s\Phi\left(-\frac{\ln\frac{K}{s}-\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}+\sigma\sqrt{T-t}\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right) \\
\,\, & = s\Phi\left(\frac{\ln\frac{s}{K}+\left(r+\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right)-Ke^{-r(T-t)}\Phi\left(\frac{\ln\frac{s}{K}+\left(r-\frac{\sigma^2}{2}\right)\left(T-t\right)}{\sigma\sqrt{T-t}}\right)
\end{align*}
Could someone help me please
 A: The Black-Scholes model prices an option written on an underlying security with price $S_\tau$ at time $\tau \in [t,T]$ that follows a geometric Brownian motion.  The price satisfies the stochastic differential equation,
$$\frac{dS_\tau}{S_\tau}= \mu \, d\tau + \sigma \,d B_\tau,$$
The drift $\mu$ can be taken to be the risk-free rate $r$ since options are priced as expected payoffs under a risk-neutral probability measure. All that is needed here is to know that the solution for the price $S_T$ at expiration $T$ with initial condition $S_t = s$ (obtained using Ito's lemma) is
$$S_T = s e^{\left(r- \frac{\sigma^2}{2}\right)(T-t)+\sigma \sqrt{T-t}Y}:= se^Z, $$
where $Y$ has a standard normal distribution with mean $0$ and  standard deviation $1$.
We see that $Z = \left(r- \frac{\sigma^2}{2}\right)(T-t)+\sigma \sqrt{T-t}Y$  is normally distributed with mean $\left(r- \frac{\sigma^2}{2}\right)(T-t)$ and standard deviation $\sigma \sqrt{T-t}$. The pdf for $Z$ is
$$f(z) = \frac{1}{\sqrt{2\pi}}\frac{1}{\sigma \sqrt{T-t}}e^{-\frac{\left(z-\left(r- \frac{\sigma^2}{2}\right)(T-t) \right)^2}{2\sigma\sqrt{T-t}} }=  \frac{1}{\sqrt{2\pi}}\frac{1}{\sigma \sqrt{T-t}} e^{-\frac{y^2}{2}}$$
The option price is the discounted expected payoff
$$\tag{1}\begin{align}F(t,s) &=  e^{-r(T-t)}\int^\infty_{-\infty} \max\left[se^z-K,0\right]f(z)\,dz \\ &=   e^{-r(T-t)} \left(s\int^{\infty}_{\ln\frac{K}{s}} e^zf(z)\,dz -K\int^{\infty}_{\ln\frac{K}{s}}f(z)\,dz \right)  \end{align}$$
Changing variables using  $z =\left(r- \frac{\sigma^2}{2}\right)(T-t)+\sigma \sqrt{T-t}y$ and noting that $f(z)\,dz = \frac{1}{\sigma \sqrt{T-t}} e^{-\frac{y^2}{2}} \, dy$, the  first integral in (1) becomes
$$\int^{\infty}_{\ln\frac{K}{s}} e^zf(z)\,dz =  \frac{1}{\sigma \sqrt{T-t}}\int_{L}^\infty e^{\left(r- \frac{\sigma^2}{2}\right)(T-t)+\sigma \sqrt{T-t}y}e^{-\frac{y^2}{2}}\,dy$$
where the correct lower limit of integration should be
$$L = \frac{\ln\frac{K}{s} - \left(r- \frac{\sigma^2}{2}\right)(T-t)}{\sigma \sqrt{T-t}}$$
