polar Laplace equation solution: Question: $    \frac{\partial^2 u}{\partial r^2}
      + \frac{1}{r}\frac{\partial u}{\partial r}
      + \frac{1}{r^2}\frac{\partial^2 u}{\partial {\theta}^2} = 0,\:\:\:\: 0\leq r \leq 3 \:\:\:\: -\pi \leq \theta \leq \pi  $   
with the boundary condition : $u(3,\theta) = 2 + \theta $ and the periodicity conditions : $u(r,\pi) = u(r,-\pi)$  and $u_{\theta}(r,\pi) = u_{\theta}(r,-\pi)$   :
My solution:
I assumed $u(r,\theta) = \psi(\theta)R(r) $
I solved for $\psi(\theta)$ and $R(r)$   and got $R(r)=c r^n$  and $\psi(\theta) = Asin(\lambda \theta) + Bcos(\lambda \theta)$
Solving the two periodicity condition just told me that $\lambda$ ( the separation constant) is $n$
My final answer is $u(r,\theta) = 2 + \sum\limits_{n=1}^\infty \frac{2}{n}(\frac{r}{3})^n (-1)^{n+1} sin(n\theta) + \frac{2}{3^n\pi n^2}((-1)^n - 1)cos(n\theta)$
But the final correct solution is : $u(r,\theta) = 2 + \sum\limits_{n=1}^\infty \frac{2}{n}(\frac{r}{3})^n (-1)^{n+1} sin(n\theta) $
so obviously the cosine coefficient (B) is $0$ according to one  of the conditions, but I don't know how or where that happens.
 A: $\newcommand{\+}{^{\dagger}}%
 \newcommand{\angles}[1]{\left\langle #1 \right\rangle}%
 \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace}%
 \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack}%
 \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,}%
 \newcommand{\dd}{{\rm d}}%
 \newcommand{\ds}[1]{\displaystyle{#1}}%
 \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}}%
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}%
 \newcommand{\fermi}{\,{\rm f}}%
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}%
 \newcommand{\half}{{1 \over 2}}%
 \newcommand{\ic}{{\rm i}}%
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}%
 \newcommand{\isdiv}{\,\left.\right\vert\,}%
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}%
 \newcommand{\ol}[1]{\overline{#1}}%
 \newcommand{\pars}[1]{\left( #1 \right)}%
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}%
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,}%
 \newcommand{\sech}{\,{\rm sech}}%
 \newcommand{\sgn}{\,{\rm sgn}}%
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}%
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
The general solution, which is finite when $r \to 0^{+}$, has the form:
$$
{\rm u}\pars{r,\theta} = A_{0}\theta + B + \sum_{n = 1}^{\infty}
\bracks{A_{n}\sin\pars{n\theta} + B_{n}\cos\pars{n\theta}}\pars{r \over 3}^{n}\tag{1}
$$
When $r \to 3^{-}$, we'll have:
$$
2 + \theta = A_{0}\theta + B + \sum_{n = 1}^{\infty}
\bracks{A_{n}\sin\pars{n\theta} + B_{n}\cos\pars{n\theta}}\tag{2}
$$
$$
\int_{-\pi}^{\pi}\pars{2 + \theta}\,\dd\theta
=
\int_{-\pi}^{\pi}\braces{A_{0}\theta + B + \sum_{n = 1}^{\infty}
\bracks{A_{n}\sin\pars{n\theta} + B_{n}\cos\pars{n\theta}}}\,\dd\theta
$$
That yields $4\pi = 2\pi B\quad\imp\quad B = 2$ such that $\pars{2}$ is reduced to
$$
\pars{1 - A_{0}}\theta =\sum_{n = 1}^{\infty}
\bracks{A_{n}\sin\pars{n\theta} +B_{n}\cos\pars{n\theta}}\tag{3}
$$
This expression leads to:
\begin{align}
\int_{-\pi}^{\pi}\bracks{\pars{1 - A_{0}}\theta}\sin\pars{m\theta}\,\dd\theta &=\sum_{n = 1}^{\infty}
\int_{-\pi}^{\pi}\!\!\!\!\!\sin\pars{m\theta}\braces{%
\bracks{A_{n}\sin\pars{n\theta} +B_{n}\cos\pars{n\theta}}}\,\dd\theta\tag{4}
\\[3mm]
\int_{-\pi}^{\pi}\bracks{\pars{1 - A_{0}}\theta}\cos\pars{m\theta}\,\dd\theta &=\sum_{n = 1}^{\infty}
\int_{-\pi}^{\pi}\!\!\!\!\!\cos\pars{m\theta}\braces{%
\bracks{A_{n}\sin\pars{n\theta} +B_{n}\cos\pars{n\theta}}}\,\dd\theta\tag{5}
\end{align}
$\pars{4}$ and $\pars{5}$ yield:
\begin{align}
2\pars{1 - A_{0}}\
\overbrace{\int_{0}^{\pi}\theta\sin\pars{m\theta}\,\dd\theta}
^{\ds{{\pars{-1}^{m + 1} \over m}\,\pi}} &= 2A_{m}\int_{0}^{\pi}\sin^{2}\pars{m\theta}\,\dd\theta = \pi A_{m}
\\[3mm]
\pars{1 - A_{0}}\
\underbrace{\int_{-\pi}^{\pi}\theta\cos\pars{m\theta}\,\dd\theta}_{\ds{0}} &= 2B_{m}\int_{0}^{\pi}\cos^{2}\pars{m\theta}\,\dd\theta = \pi B_{m}
\end{align}
$\ds{\imp\quad A_{m}
     = 2\pars{1 - A_{0}}\,{\pars{-1}^{m + 1} \over m}
     \quad\mbox{and}\quad B_{m} = 0}$. $\pars{1}$ is reduced to:
$$
{\rm u}\pars{r,\theta}
=
A_{0}\theta + 2 + 2\pars{1 - A_{0}}\sum_{n = 1}^{\infty}{\pars{-1}^{n + 1} \over n}\,
\pars{r \over 3}^{n}\sin\pars{n\theta}
$$
where $A_{0}$ satisfies
$$
A_{0}\pars{-\pi} + 2 = A_{0}\pi + 2\quad\imp\quad A_{0} = 0 
$$
$$
\color{#0000ff}{\large{\rm u}\pars{r,\theta}
=
2 - 2\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over n}\,
\pars{r \over 3}^{n}\sin\pars{n\theta}}
$$

Also,
$$
{\rm u}\pars{r,\theta}
=
2 - 2\Im\overbrace{\sum_{n = 1}^{\infty}{\pars{-1}^{n} \over n}\,z^{n}}
^{\ds{\equiv\ \varphi\pars{z}}}\quad\mbox{where}\quad
z = {r \over 3}\,\expo{\ic \theta}
$$
$$
\varphi'\pars{z} = -\sum_{n = 1}^{\infty}\pars{-z}^{n - 1}
=
-\,{1 \over 1 - \pars{-z}}\,,\qquad\varphi\pars{0} = 0
$$
$$
\varphi\pars{z} = -\ln\pars{1 + z} = -\ln\pars{1 + {r \over 3}\,\cos\pars{\theta}
+ {r \over 3}\,\sin\pars{\theta}\ic}
$$
$$
\Im\varphi\pars{z} =
-\arctan\pars{r\sin\pars{\theta}/3 \over 1 + r\cos\pars{\theta}/3}
$$
$$
\color{#0000ff}{\large{\rm u}\pars{r,\theta}
=
2 + 2\arctan\pars{r\sin\pars{\theta}/3 \over 1 + r\cos\pars{\theta}/3}}$$

Notice that $\pars{~\mbox{when}\ r \to 3^{-}~}$ we'll have:
\begin{align}
\arctan\pars{r\sin\pars{\theta}/3 \over 1 + r\cos\pars{\theta}/3}
&\to\arctan\pars{\sin\pars{\theta} \over 1 + \cos\pars{\theta}}
=
\arctan\pars{1 - \cos\pars{\theta} \over \sin\pars{\theta}}
\\[3mm]&=
\arctan\pars{2\sin^{2}\pars{\theta/2} \over 2\sin\pars{\theta/2}\cos\pars{\theta/2}}
=
\arctan\pars{\sin\pars{\theta/2} \over \cos\pars{\theta/2}}
\\[3mm]&=
\arctan\pars{\tan\pars{\theta \over 2}} = {\theta \over 2}
\end{align}
such that $\ds{\lim_{r \to 3^{-}}{\rm u}\pars{r,\theta} = 2 + \theta}$.
