Integral of voltage, $\int_{-a}^a \frac{dy}{\sqrt{x^2 + y^2}}$ This is (probably) a very easy integral to solve, but for some reason the answer just isn't coming to me (or at least the one my professor got isn't). He gave us a formula for voltage along the x-axis from a charged wire of length 2a, but none of the details are particularly important to my question. The integral I'm looking to solve is: $$ \int_{-a}^a \frac{dy}{\sqrt{x^2 + y^2}}$$
The answer my professor got is $$\ln\left(\frac{\sqrt{a^2+x^2}+a}{\sqrt{a^2+x^2}-a}\right) $$
and I'm not entirely sure how. Can someone go over this integral step-by-step so I know what I'm missing?

The ideal substitution in this case would be $\sqrt{x^2+y^2}+y=t$. The substitution relation gives $t$ as a function of $y$, but we also need to know $y$ as a function of $t$. We can isolate $y$ as follows:
$$\begin{align}
\sqrt{x^2+y^2}+y&=t\\
\sqrt{x^2+y^2}&=t-y\\
x^2+y^2&=(t-y)^2\\
x^2+y^2&=t^2-2ty+y^2\\
x^2&=t^2-2ty\\
2ty&=t^2-x^2\\
y&=\frac{t^2-x^2}{2t}.
\end{align}$$
Differentiating, we also find:
$$\mathrm{d}y=\frac{x^2+t^2}{2t^2}\,\mathrm{d}t.$$
Thus,
$$\begin{align}
\int_{-a}^{a}\frac{\mathrm{d}y}{\sqrt{x^2+y^2}}
&=\int_{\sqrt{x^2+a^2}-a}^{\sqrt{x^2+a^2}+a}\frac{2t}{x^2+t^2}\cdot\frac{x^2+t^2}{2t^2}\,\mathrm{d}t\\
&=\int_{\sqrt{x^2+a^2}-a}^{\sqrt{x^2+a^2}+a}\frac{\mathrm{d}t}{t}\\
&=\ln{\left(\sqrt{x^2+a^2}+a\right)}-\ln{\left(\sqrt{x^2+a^2}-a\right)}\\
&=\ln{\left(\frac{\sqrt{x^2+a^2}+a}{\sqrt{x^2+a^2}-a}\right)}.~~\blacksquare
\end{align}$$
