Electric potential due to two infinite planes as a function of $x$ Problem: Two infinite planes with surface charges $+\sigma$ and $-\sigma$ are perpendicular to the $x$-axis at $x=0$ and $x=2$ respectively. Determine an expression for the potential as a function of $x$ using:
$$V(\vec{r})=\frac{1}{4\pi\epsilon_o}\int\frac{\sigma(\mathbf{r'})}{|\mathbf{r}-\mathbf{r'}|}da'$$
Calculate the electric field to check your answer.
Attempt:
I first calculate the potential for $x=0$. I attempt to use a cylinder where $s=\sqrt{y^2+z^2}=\infty$, $x=x$ and $\phi=2\pi$:
$$V_1=\frac{1}{4\pi\epsilon_o}\int_0^s\int_0^{2\pi}\frac{\sigma}{\sqrt{s^2+x^2}}d\phi ds=\frac{\sigma}{2\epsilon_o}(\sqrt{s^2+x^2}-x)$$
For $x=2$:
$$V_2=-\frac{\sigma}{2\epsilon_o}(\sqrt{s^2+(x-2)^2}-(x-2))$$
So that the potential is
$$V=V_1+V_2$$
When calculating the electric field, I get:
$$E_1=-\frac{\sigma}{2\epsilon_o}(\frac{x}{\sqrt{s^2+x^2}}-1)$$
$$E_2=\frac{\sigma}{2\epsilon_o}(\frac{x-2}{\sqrt{s^2+(x-2^2)}}-1)$$
And by superposition
$$E=-\frac{\sigma}{2\epsilon_o}(\frac{x}{\sqrt{s^2+x^2}}-\frac{x-2}{\sqrt{s^2+(x-2)^2}})$$
When I look at $E$, I don't get an answer that makes sense to me, but by looking at $E_1$ and $E_2$ separately, and knowing that they're gonna have different sign notations due to their different normal vectors, I feel like it could make sense.Would it correct to say that this is the answer:
$$V=\frac{\sigma}{2\epsilon_o}(\sqrt{s^2+x^2}-\sqrt{s^2+(x-2)^2})$$
$$
E=
\begin{cases}
0 & \text{if $x<0$ or $x>2$;}\\
\frac{\sigma}{\epsilon_o} & \text{if $0<x<2$;}\\
\end{cases}
$$
I feel as if though calculating the electric field with Gauss' law and calculating the electric potential with a line integral makes this question much simpler, but the question says to do it this way so I'm pretty lost.
 A: $\newcommand{\dd}{\mathrm{d}}$You missed the jacobian of the polar coordinates: it should be
\begin{equation*}
V(x)=\frac{\sigma}{4\pi\epsilon_0}\int_0^s\int_0^{2\pi}\frac{s}{\sqrt{s^2+x^2}}\dd\phi\,\dd s=\frac{\sigma}{2\epsilon_0}(\sqrt{s^2+x^2}-\lvert x\rvert).
\end{equation*}
The integral is anyway almost correct: when simplifying the square root you have $\sqrt{x^2}=\lvert x\rvert$ and not just $x$.
This leads to the electric field (whose $y$ and $z$ components are necessarily zero because of the rotational symmetry around the $x$ axis)
\begin{equation*}
E(x)=-\frac{\sigma}{2\epsilon_0}\frac{\dd}{\dd x}\bigl[\sqrt{s^2+x^2}-\lvert x\rvert\bigr]=
-\frac{\sigma}{2\epsilon_0}\biggl(\frac{x}{\sqrt{s^2+x^2}}-\operatorname{sign}(x)\bigg)
\end{equation*}
whic for $s\to+\infty$ is just $\frac{\sigma}{2\epsilon_0}\operatorname{sign}(x)$.
You can then superpose the electric field of the other plane, which, by analogy, is $-\frac{\sigma}{2\epsilon_0}\operatorname{sign}(x-2)$.
You are close, but your derivation is incorrect because you missed the absolute values of $x$ and $x-2$ in the electric fields: it's this peculiarity that gives the correct direction of the fields and makes them such that they cancel outside the region between the planes, and add inside it.
