TeX source:
\begin{aligned} d &= \sqrt{(x−0)^2+(y−p)^2} \\ &= \sqrt{x^2+(y−p)^2} \end{aligned}