In a past-exam for my PDE class, there is a question involving finding a solution to the Laplace equation (in radial terms) at a boundary $f(\theta)=\cos \theta$
Consider the Laplace equation in a circular domain of radius $a>0$. Given that the general solution $u(r,\theta)$ of this equation in polar coordinates $$u_{rr}+\frac{1}{r}u_r+\frac{1}{r^2}u_{\theta\theta}=0, \quad r<a$$ which additionally satisfies the boundary condition $$u(a,\theta)=f(\theta)$$ is given by Poisson's formula $$u = \frac{a^2-r^2}{2\pi} \int_0^{2\pi}\frac{f(\xi)}{a^2-2ar\cos(\theta-\xi)+r^2} \mathrm{d}\xi$$ Find the solution, using Poisson's formula, when $f(\theta)=\cos \theta$, given that one may use without proof: $$\int_{0}^{2\pi}\frac{\cos z}{1-\alpha \cos z} = 2\pi\frac{1-\sqrt{1-\alpha^2}}{\alpha\sqrt{1-\alpha^2}}, \quad |\alpha|<1$$
Substituting the boundary condition and integrating is not difficult, and one reaches to the solution:
$$u=\cos \theta \frac{a^2-r^2}{a^2+r^2} \frac{1-\sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}}{\frac{2ar}{a^2+r^2} \sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}}$$
the annoyance arrives in the following, by simplifying (given that $0<r<a$):
\begin{align} \cos \theta \frac{a^2-r^2}{a^2+r^2} \frac{1-\sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}}{\frac{2ar}{a^2+r^2} \sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}} =&\cos \theta \frac{a^2-r^2}{2ar} \frac{1-\sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}}{ \sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{1-\frac{1}{a^2+r^2}\sqrt{(a^2+r^2)^2-4a^2r^2}}{ \frac{1}{a^2+r^2}\sqrt{(a^2+r^2)^2-4a^2r^2}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-\sqrt{(a^2+r^2)^2-4a^2r^2}}{ \sqrt{(a^2+r^2)^2-4a^2r^2}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-\sqrt{a^4+2a^2r^2+r^4-4a^2r^2}}{ \sqrt{a^4+2a^2r^2+r^4-4a^2r^2}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-\sqrt{a^4-2a^2r^2+r^4}}{ \sqrt{a^4-2a^2r^2+r^4}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-\sqrt{(a^2-r^2)^2}}{ \sqrt{(a^2-r^2)^2}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-\sqrt{(r^2-a^2)^2}}{ \sqrt{(r^2-a^2)^2}}\\ =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-|r^2-a^2|}{ |r^2-a^2|}\\ \end{align} Since $0<r<a$ then $r^2<a^2$ then $|r^2-a^2|=a^2-r^2$ \begin{align} =&\cos \theta \frac{a^2-r^2}{2ar} \frac{a^2+r^2-(a^2-r^2)}{ (a^2-r^2)} \\ =&\cos \theta \frac{2r^2}{2ar}\\ u=&\cos \theta \frac{r}{a} \end{align} which is the desired solution.
Since is this on an previous exam I should expect to maybe encounter solutions of similar complexity. Is there anyway I can simplify the solution in a much faster manner since there are many terms arising from the binomial $(a^2+r^2)$ such as $2ar$ or $4a^2r^2$ when it is squared.
I don't want to spend too much time on the exam trying to simplify such things at the risk of making a stupid algebraic error causing me to get stuck.
Can anyone give me any quick algebraic realizations one can see to arrive to the solution quicker?
This may not be the answer you're looking for.
There is a way to "see" the solution without doing the integral. If you're familiar with separation of variables, the general solution of Laplace's equation on a disk has the form
$$ u(r,\theta) = A_0 + \sum_{n=1}^\infty r^{n}\big(A_n\cos (n\theta) + B_n\sin (n\theta)\big) $$
The boundary condition reads
$$ u(a,\theta) = A_0 + \sum_{n=1}^\infty a^n\big(A_n\cos(n\theta)+B_n\sin(n\theta)\big) = \cos(\theta) $$
When comparing terms, the only non-zero coefficent is $A_1 = \frac{1}{a}$, so the solution is
$$ u(r,\theta) = \frac{r}{a}\cos(\theta) $$
Edit: Your working is pretty much correct. If you want to be more efficient, consider reducing the square root first:
\begin{align} \sqrt{1-\alpha^2} &= \sqrt{1-\frac{4a^2r^2}{(a^2+r^2)^2}} \\ &= \sqrt{\frac{a^4 - 2a^2r^2 + r^4}{(a^2+r^2)^2}} \\ &= \sqrt{\frac{(a^2-r^2)^2}{(a^2+r^2)^2}} \\ &= \frac{a^2-r^2}{a^2+r^2} \end{align}
Then
\begin{align} \frac{1-\sqrt{1-\alpha^2}}{\alpha\sqrt{1-\alpha^2}} &= \frac{1-\frac{a^2-r^2}{a^2+r^2}}{\frac{2ar(a^2-r^2)}{(a^2+r^2)^2}} \\ &= (a^2+r^2)\frac{(a^2+r^2)-(a^2-r^2)}{2ar(a^2-r^2)} \\ &= (a^2+r^2)\frac{2r^2}{2ar(a^2-r^2)} \\ &= \frac{r}{a}\frac{a^2+r^2}{a^2-r^2} \end{align}
and the rest follows.