I am working on the following problem where I keep on getting one sign different than the answer in the back of the book:
Find the steady-state distribution of temperature in the half space $H = \{ y > 0 \}$ if the boundary temperature is $\displaystyle u(x,0) = \begin{cases} 1 & \text{if}\, -1<x<0 \\ 1-x & \text{if}\,0<x<1 \\ 0 & \text{otherwise}\end{cases}$.
I.e., I need to solve the Laplace equation $u_{xx}(x,y) + u_{yy}(x,y) = 0$ with the boundary condition $\displaystyle u(x,0) = \begin{cases} 1 & \text{if}\, -1<x<0 \\ 1-x & \text{if}\,0<x<1 \\ 0 & \text{otherwise}\end{cases}$.
First, I let $\displaystyle U(\alpha,y) = \frac{1}{2 \pi} \int_{-\infty}^{\infty}u(x,y)e^{-i\alpha x}dx$, and then converted the equation to
$\begin{align} -\alpha^{2} U(\alpha,y) + U^{\prime\prime}(\alpha,y) = 0 \end{align}$
which has a general solution of the form $U(\alpha,y) = A e^{-|\alpha|y}+B e^{|\alpha|y}. $
In order to make sure that our solution is bounded as we go off to $\infty$, we let $B = 0$, and so the general solution is of the form $U(\alpha,y)=A e^{-|\alpha|y}.$
Now, $\displaystyle F(\alpha) = \frac{1}{2 \pi} \int_{-\infty}^{\infty} f(x) \exp[i \alpha x] dx$
Let $G(\alpha) = \exp(-|\alpha|y)$, then $\displaystyle u(x,y) = f * g = \frac{1}{2\pi}f * \mathcal{F}^{-1}\left[\exp(-|\alpha|y)\right]$ where $'*'$ denotes the convolution product.
Earlier, I found $\displaystyle\mathcal{F}^{-1}\left[\exp(-|\alpha|y)\right] = \frac{2y}{(x-z)^{2}+y^{2}}$, so $\displaystyle \begin{align}u(x,y) = \frac{1}{2\pi} \int_{-\infty}^{\infty}f(z) \frac{2y}{(x-z)^{2}+y^{2}}dz \\ = \frac{1}{\pi} \int_{-1}^{0}\frac{y}{(x-z)^{2}+y^{2}}dz + \frac{1}{\pi}\int_{0}^{1}(1-z)\frac{y}{(x-z)^{2}+y^{2}}dz \\ = \frac{1}{\pi} \int_{-1}^{0}\frac{y}{(x-z)^{2}+y^{2}}dz + \frac{1}{\pi}\int_{0}^{1}\frac{y}{(x-z)^{2}+y^{2}}dz -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz\end{align}$.
Next, I took care of the first two integrals by using the trig substitution $\displaystyle \tan \theta = \frac{x-z}{y}$, $\displaystyle z=x-y\tan \theta$, $dz = -y \sec^{2}\theta d\theta$, and so the above became:
$\displaystyle \begin{align} = -\frac{1}{\pi}\int_{z=-1}^{z=0}\frac{y^{2}\sec^{2}\theta d\theta}{y^{2}\sec^{2}\theta} - \frac{1}{\pi}\int_{z=0}^{z=1}\frac{y^{2}\sec^{2}\theta d\theta}{y^{2} \sec^{2}\theta} -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz \\ = \displaystyle -\frac{1}{\pi}\left[ \theta \right]_{\arctan\left(\frac{x+1}{y} \right)}^{ \arctan\left(\frac{x}{y} \right)}-\frac{1}{\pi}\left[ \theta \right]_{\arctan\left(\frac{x}{y} \right)}^{ \arctan\left(\frac{x-1}{y} \right)} -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz \\ = -\frac{1}{\pi} \left[\arctan\left( \frac{x}{y}\right)- \arctan \left(\frac{x+1}{y} \right) \right] - \frac{1}{\pi}\left[\arctan \left(\frac{x-1}{y} \right) - \arctan \left(\frac{x}{y} \right) \right]\\ -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz\end{align}$.
Then, I used the fact that the $\arctan$ function is odd, and so $\arctan\left(\frac{x-1}{y}\right) = \arctan\left(\frac{-1+x}{y} \right) = \arctan \left( \frac{-(1-x)}{y}\right) = -\arctan \left(\frac{1-x}{y} \right)$. Therefore, the above becomes:
$\displaystyle \begin{align} -\frac{1}{\pi} \left[\arctan\left( \frac{x}{y}\right)- \arctan \left(\frac{x+1}{y} \right) \right] - \frac{1}{\pi}\left[-\arctan \left(\frac{1-x}{y} \right) - \arctan \left(\frac{x}{y} \right) \right] \\ -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz \\ = -\frac{1}{\pi} \left[\arctan\left( \frac{x}{y}\right)- \arctan \left(\frac{x+1}{y} \right) \right] - \frac{1}{\pi}\left[-\left(\arctan \left(\frac{1-x}{y} \right) + \arctan \left(\frac{x}{y} \right)\right) \right] \\ -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz \\ = \frac{1}{\pi} \left[\arctan \left(\frac{x+1}{y} \right) - \arctan\left( \frac{x}{y}\right) \right] + \frac{1}{\pi}\left[\arctan \left(\frac{1-x}{y} \right) +\arctan \left(\frac{x}{y} \right) \right]\\ -\frac{1}{\pi}\int_{0}^{1}\frac{yz}{(x-z)^{2} + y^{2}}dz\end{align}$
For the last integral, I let $u = x-z$, $z=x-u$, $dz=-du$. Then, $\displaystyle \begin{align}-\frac{1}{\pi}\int_{z=0}^{z=1}\frac{yz}{(x-z)^{2} + y^{2}}dz = -\frac{y}{\pi}\int_{z=0}^{z=1}\frac{x-u}{u^{2} + y^{2}} (-du) \\ = -\frac{y}{\pi}\int_{z=0}^{z=1}\frac{-x+u}{u^{2}+y^{2}}du \\ = -\frac{y}{\pi}\int_{z=0}^{z=1}\frac{-x}{u^{2}+y^{2}}du - \frac{y}{\pi}\int_{z=0}^{z=1}\frac{u}{u^{2}+y^{2}}du \\ = \frac{y}{\pi}\int_{z=0}^{z=1}\frac{x}{u^{2}+y^{2}}du - \frac{y}{\pi}\int_{z=0}^{z=1}\frac{u}{u^{2}+y^{2}}du \end{align}$
As before, on the first integral, I use the trig substitution $\tan \varphi = \frac{u}{y}$, $u = y \tan \varphi$, $du = y \sec^{2}\varphi d \varphi$, and $\displaystyle \frac{y}{\pi}\int_{z=0}^{z=1}\frac{x}{u^{2}+y^{2}} =\frac{x}{\pi}\arctan\left(\frac{u}{y} \right)_{z=0}^{z=1} = \frac{x}{\pi} \arctan\left( \frac{x-z}{y}\right)_{0}^{1} = \frac{x}{\pi}\arctan \left(\frac{x-1}{y}\right) - \frac{x}{\pi}\arctan \left(\frac{x}{y} \right)= -\frac{x}{\pi}\arctan \left(\frac{1-x}{y}\right) - \frac{x}{\pi}\arctan \left(\frac{x}{y} \right)$
On the second integral, I let $w=u^{2}+y^{2}$, $\displaystyle \frac{dw}{2} = u du$, and so obtain $\displaystyle -\frac{y}{\pi}\int_{0}^{1}\frac{u}{u^{2}+y^{2}}du = -\frac{y}{2\pi}\int_{z=0}^{z=1}\frac{dw}{w} = -\frac{y}{2\pi}\left[\ln |w| \right]_{z=0}^{z=1} = -\frac{y}{2\pi} \left[\ln(u^{2}+y^{2})\right]_{z=0}^{z=1} = -\frac{y}{2\pi}\left[\ln((x-z)^{2}+y^{2})\right]_{z=0}^{z=1} = -\frac{y}{2\pi}\left[\ln((x-1)^{2}+y^{2})\right] + \frac{y}{2\pi}\left[\ln(x^2+y^2)\right] \\= \frac{y}{2\pi}\ln \left[\frac{x^2+y^2}{(x-1)^2+y^2} \right] $.
Putting these back together, we have that $\displaystyle \begin{align}u(x,y) = \frac{1}{\pi} \left[\arctan \left(\frac{x+1}{y} \right) - \arctan\left( \frac{x}{y}\right) \right] + \frac{1}{\pi}\left[\arctan \left(\frac{1-x}{y} \right) +\arctan \left(\frac{x}{y} \right) \right] -\frac{x}{\pi}\arctan \left(\frac{1-x}{y}\right) - \frac{x}{\pi}\arctan \left(\frac{x}{y} \right)+ \frac{y}{2\pi}\ln \left[\frac{x^2+y^2}{(x-1)^2+y^2} \right] \\ = \frac{1}{\pi} \left[\arctan \left(\frac{x+1}{y} \right) - \arctan\left( \frac{x}{y}\right) \right] \mathbf{+} \frac{1-x}{\pi}\left[\arctan\left(\frac{x}{y}\right) + \arctan \left( \frac{1-x}{y}\right)\right]+\frac{y}{2\pi}\ln \left[\frac{x^2+y^2}{(x-1)^2+y^2} \right] \end{align}$
According to the back of my book, the final answer I am supposed to get is $\displaystyle \frac{1}{\pi}\left[\arctan \left(\frac{x+1}{y} \right)- \arctan \left(\frac{x}{y} \right)\right] \mathbf{-} \frac{1-x}{\pi}\left[\arctan \left(\frac{x}{y}\right) + \arctan \left(\frac{1-x}{y} \right) \right] + \frac{y}{2 \pi}\ln \left[\frac{x^{2}+y^{2}}{(x-1)^{2}+y^{2}} \right]$
The book gets $- \frac{1-x}{\pi}$ and I get $ +\frac{1-x}{\pi}$. Which one of us is right: me or the book? And if it's the book, where did I go wrong with that sign?
Thank you.
Whenever you have done a long calculation and get results you are not sure about it's useful to do some simple consistency checks to convince yourself. You can try to check that your solution satisfy the PDE you are solving by plugging it into the PDE (this can be a bit cumbersome if done by hand) and, often simpler, you can try to check that you recover the correct initial condition $u(x,0)$ in the limit $y\to 0^+$ (an even simpler thing to do is just to plot the solution $u(x,\epsilon)$ for some small $\epsilon$ and see if it matches $u(x,0)$). If you do both of these then you can be sure that you have the correct solution.
All we have to do to show that the answer in the book is wrong is to show that it does not agree with the given initial conditions in the limit $y\to 0^+$. Using $\lim\limits_{t\to+\infty}\arctan(t) = \frac{\pi}{2}$ we find that
$$\lim_{y\to 0^+,~0<x<1} u^{\rm (Book)}(x,y) = \frac{1}{\pi}\left(\frac{\pi}{2}-\frac{\pi}{2}\right) \color{red}{-} \frac{1-x}{\pi}\left(\frac{\pi}{2} + \frac{\pi}{2}\right) + \frac{0}{2\pi}\log\left(\frac{x^2 + 0^2}{(x-1)^2 + 0^2}\right) = \color{red}{-}(1-x)$$
which is wrong. Your solution on the other hand gives the correct answer $\color{red}{+}(1-x)$.
I also checked that your answer is correct by using mathematical software that can do symbolic calculations. See the Mathematica code below, your answer passes all the checks.