Solving Laplace's Equation - weird boundary conditions? The potential is given by:
$$V = \sum_{n=0}^{\infty} \left[a_n r^n +b_nr^{-(n+1)}\right] P_n(cos \theta) $$
I want to find potential for $r \geq a$  using th definition $I_n = \int_0^1 P_n(x) \space  dx$.
The boundary conditions are:


*

*$V\rightarrow 0$ as $r\rightarrow \infty$


This is easy, it simply means $a_n = 0$, so $V = \sum_{n=0}^{\infty} b_nr^{-(n+1)} P_n(cos \theta)$
2 . At r = a, for $ 0 \leq \theta \leq \frac{\pi}{2} $, $V=1$ and for $ \frac{\pi}{2} < \theta \leq \pi $, $V=0$.
How do I even proceed?
 A: For $t \in (-1,1)$, let $\theta_t(x)$ be the step function
$$\theta_t(x) = \begin{cases} 1,& x > t\\ \frac12,& x = t\\0,& x < t\end{cases}$$
If one expand it over $[-1,1]$ using Legendre polynomials, we have
$$\theta_t(x) = \sum_{\ell=0}^\infty \frac{2\ell+1}{2} \left( \int_{-1}^1 \theta_t(s) P_\ell(s) ds \right) P_\ell(x)
= \sum_{\ell = 0}^\infty \frac{2\ell+1}{2}
\left( \int_{t}^1 P_\ell(s) ds \right) P_\ell(x)
$$
To simplify expressions below, we will adopt the convention that $P_{-1}(x) = 1$. Under this convention, we have for any $\ell \in \mathbb{N}$,
$$(2\ell+1) P_\ell(x) = \frac{d}{dx} \Big[ P_{l+1}(x) - P_{l-1}(x) \Big]$$
This leads to 
$$\int_t^1 P_{\ell}(x)\,dx = \frac{1}{2\ell+1}\Big[P_{l+1}(s) - P_{l-1}(s)\Big]_t^1 = \frac{1}{2\ell+1}\Big[P_{l-1}(t) - P_{l+1}(t)\Big]$$
Substitute this back into expansion of $\theta_t(x)$, we obtain:
$$\theta_t(x) = \frac12 \sum_{\ell=0}^\infty \Big(P_{\ell-1}(t) - P_{\ell+1}(t)\Big)P_\ell(x)$$
Notice when $t = 0$, we have
$$P_{\ell}(0) = \begin{cases}
1, & l = -1\\
0, & l = 2k+1\\
{\large \frac{(-1)^k (\frac12)_k}{k!}}, &l = 2k
\end{cases}
$$
where $(\gamma)_k = \gamma(\gamma+1)\cdots(\gamma+k-1)$ is the $k^{th}$ rising
Pochhammer symbol.
This give us
$$\begin{align}
\theta_0(x) 
&= \frac12 
\left[ P_{0}(x) + \sum_{k=0}^\infty \Big(P_{2k}(0) - P_{2k+2}(0)\Big) P_{2k+1}(x) \right]\\
&= \frac12 P_{0}(x) + \sum_{k=0}^\infty \frac{(-1)^k(\frac12)_k}{k!}\left(\frac{4k+3}{4k+4}\right) P_{2k+1}(x)\end{align}$$
At $r = a$, your potential
$$V(r,\theta) = \sum_{n=0}^{\infty} \frac{b_n}{r^{n+1}} P_n(\cos\theta)$$
reduces to $\theta_0(\cos\theta)$. If one compare the coefficients for Legendre polynomials, one find
$$V(r,\theta) = \frac12 \frac{a}{r} + \sum_{k=0}^\infty \frac{(-1)^k(\frac12)_k}{k!}\left(\frac{4k+3}{4k+4}\right) \left(\frac{a}{r}\right)^{2k+2} P_{2k+1}(\cos\theta)$$
Update
For general $\theta$, there is no closed form expression for $V(r,\theta)$.
However, we do know what happens along the $z$-axis outside the sphere.
Let $\epsilon = \pm 1$ and $r \in [a,\infty)$. The point $p = (0,0,\epsilon r)$ lies on
the positive or negative $z$-axis depends on the sign of $\epsilon$. Notice
$$\theta(p) = \begin{cases}0,&\epsilon = +1\\ \pi,&\epsilon = -1\end{cases}
\quad\implies\quad
\cos\theta(p) = \epsilon
\quad\implies\quad
P_{2k+1}(\cos\theta(p)) = \epsilon
$$
We have
$$\begin{align}
V(p) 
&= \frac{a}{2r} + \epsilon \sum_{k=0}^\infty \frac{(-1)^k(\frac12)_k}{k!}\left(\frac{4k+3}{4k+4}\right) \left(\frac{a}{r}\right)^{2k+2}\\
&= \frac{a}{2r} + \epsilon \sum_{k=0}^\infty (-1)^k 
\left[\frac{(\frac12)_k}{k!}
+ \frac12 \frac{(-\frac12)_{k+1}}{(k+1)!}
\right]\left(\frac{a}{r}\right)^{2k+2}\\
&=\frac{a}{2r} + \epsilon\left[\left(\frac{a}{r}\right)^2 \frac{1}{\sqrt{1+\left(\frac{a}{r}\right)^2}}
- \frac12 \left(\sqrt{1+\left(\frac{a}{r}\right)^2} - 1\right)\right]\\
&=\frac{a}{2r} + \epsilon\left[ \frac12 + \frac{a^2-r^2}{2r\sqrt{r^2+a^2}}\right]
\end{align}
$$
In particular, this recover what we expected as $r \to a_{+}$:
$$\lim_{r\to a_{+}} V(p) = \frac{1}{2} + \frac{\epsilon}{2} = 
\begin{cases}1,& \epsilon = +1\\0,& \epsilon = -1\end{cases}$$
For an alternate treatment of this sort of potential, take a look at section $2.7$ ( and problem $2.22$ ) of J.D Jackson's classic Classical electrodynamics, 3rd Edition.
A: The 2nd boundary condition specifies the potential distribution on the surface r = a. This distribution of two constant values in two halves could simply be described by a step function of the angle. Then you have for this an expression to solve. 
A: The second boundary condition gives,
$$ \sum_{l=0}^\infty \frac{b_l}{a^{l+1}} P_l(\cos(\theta)) = V(\theta) \qquad \textbf{(1)}. $$
To invert this equation for the $b_l$'s we need to exploit the orthogonality of the Legendre polynomials,
$$ \int_0^\pi P_l(\cos(\theta)) P_{l'}(\cos(\theta)) \sin(\theta) d\theta = \frac{2}{2l+1} \delta_{l,l'}$$
Multiplying both sides of $\textbf{(1)}$ by $P_{l'}$ and integrating from $0$ to $pi$ with respect to the measure $\sin(\theta)d\theta$ we collapse the sum on the left to just one term and are left with,
$$ \frac{2}{2l'+1}\frac{b_{l'}}{a^{l'+1}} = \int_0^\pi V(\theta) P_{l'}(\cos(\theta)) \sin(\theta) d\theta  \qquad \textbf{(2)}. $$
All that is left is to evaluate the integral. I don't recall a closed form expression for this particular potential but if there is one it can probably be found using the identities in Chapter 22 of Abromowitz and Stegun's "Handbooks of Mathematical Functions".
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{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \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]{\vphantom{\large A}\,#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}
 \newcommand{\wt}[1]{\widetilde{#1}}$
\begin{align}
{\rm V}\pars{r,\theta}&
=\half + \sum_{\ell = 0}^{\infty}a_{\ell}\pars{a \over r}^{2\pars{\ell + 1}}
{\rm P}_{2\ell + 1}\pars{\cos\pars{\theta}}
\end{align}

$$
\int_{0}^{\pi/2}{\rm P}_{2\ell' + 1}
\pars{\cos\pars{\theta}}\sin\pars{\theta}\,\dd\theta
=\half + {a_{\ell'} \over 2\pars{2\ell' + 1} + 1}
$$

$$
a_{\ell}=\pars{-2\ell - 1} - \half
+ \pars{4\ell + 3}\int_{0}^{1}{\rm P}_{2\ell + 1}\pars{x}\,\dd x
$$

\begin{align}
{\rm V}\pars{r,\theta}
&=\half
-\pars{a \over r}^{2}\color{#c00000}{\sum_{\ell = 0}^{\infty}
\pars{2\ell + 1}\pars{a \over r}^{2\ell}{\rm P}_{2\ell + 1}\pars{\cos\pars{\theta}}}
\\[3mm]&-\half\,{a \over r}\color{#00f}{\sum_{\ell = 0}^{\infty}
\pars{a \over r}^{2\ell + 1}{\rm P}_{2\ell}\pars{\cos\pars{\theta}}}
+\sum_{\ell = 0}^{\infty}
b_{\ell}\pars{a \over r}^{2\ell + 2}{\rm P}_{2\ell + 1}\pars{\cos\pars{\theta}}
\end{align}
  where $\ds{b_{\ell} \equiv \pars{4\ell + 3}\int_{0}^{1}{\rm P}_{2\ell + 1}\pars{x}\,\dd x}$.

Also
\begin{align}
{1 \over \root{1 - 2xh + h^{2}}}&=\sum_{\ell = 0}h^{\ell}{\rm P}_{\ell}\pars{x}
\\
{1 \over \root{1 + 2xh + h^{2}}}&=\sum_{\ell = 0}h^{\ell}\pars{-1}^{\ell}
{\rm P}_{\ell}\pars{x}
\end{align}
$$
\imp\quad\color{#00f}{%
{1 \over \root{1 - 2xh + h^{2}}}
-
{1 \over \root{1 + 2xh + h^{2}}}
=2\sum_{\ell = 0}h^{2\ell + 1}{\rm P}_{2\ell + 1}\pars{x}}\tag{1}
$$
$$
\imp\quad\color{#c00000}{%
{h + x \over \pars{1 - 2xh + h^{2}}^{3/2}}
-
{h - x \over \pars{1 + 2xh + h^{2}}^{3/2}}
=2\sum_{\ell = 0}\pars{2\ell + 1}h^{2\ell}{\rm P}_{2\ell + 1}\pars{x}}
$$
By following the $\color{#c00000}{\tt co}\color{#00f}{\tt lors}$ we find 'closed expressions' for two terms of the solution. $\ds{b_{\ell}}$ is calculated by integrating $\pars{1}$ over $\ds{x}$ and expanding in powers of $\ds{h}$.
