In the first figure, the vector field is everywhere parallel to the cylinder, so the flux must be zero. In the second figure, although there is nonzero flux locally, the symmetry of the cylinder (and the constancy of the vector field) ensures that the flux in on the left is the same as the flux out on the right, so that the total flux is again zero.
Look before you leap!
Flux is given by \(\displaystyle\int\boldsymbol{\vec F}\cdot d\boldsymbol{\vec A}\), where \(\boldsymbol{\vec A}=\boldsymbol{\hat n}\,dA\). For the sides of the cylinder, \(\boldsymbol{\hat n}=\boldsymbol{\hat r} =\frac1r(x\,\boldsymbol{\hat x}+y\,\boldsymbol{\hat y}\)), so \(\boldsymbol{\vec F}\cdot\boldsymbol{\hat n} =\frac{x^2+y^2}{r}=r=2\), so the flux through the sides is just twice the area, namely \(2\pi rh=2\pi(2)(6)=24\pi\).
For the two caps, \(\boldsymbol{\hat n}=\pm\boldsymbol{\hat z}\), so \(\boldsymbol{\vec F}\cdot\boldsymbol{\hat n}=\pm z=+3\) in both cases, so the flux through the caps is \(3+3\) times the area, namely \(6\pi r^2=24\pi\).
Adding up the pieces, the total flux out of the cylinder is \(48\pi\).
Working in spherical coordinates, the angle between \(\boldsymbol{\hat z}\) and \(\boldsymbol{\hat n}=\boldsymbol{\hat r}\) is clearly the spherical angle \(\theta\) (colatitude). Furthermore, since the vertical projection of \(r\,\boldsymbol{\hat r}\) is \(z\,\boldsymbol{\hat z}\), we also have \(z=r\,\cos\theta\). Thus, \(\boldsymbol{\vec F}\cdot\boldsymbol{\hat n} = z^2\cos\theta = r^2\cos^3\theta\). So \begin{align*} \int\boldsymbol{\vec F}\cdot d\boldsymbol{\vec A} &= \int r^2\cos^3\theta\,dA \\ &= \int r^2\cos^3\theta (r^2\sin\theta\,d\theta\,d\phi) \\ &= 2\pi r^4 \int \cos^3\theta\sin\theta\,d\theta \\ &= -2\pi r^4 \frac{\cos^4\theta}{4} \bigg|_0^{\pi/2} = \frac{625\pi}{2} \end{align*}
Flux is given by \(\displaystyle\int\boldsymbol{\vec F}\cdot d\boldsymbol{\vec A}\), where \(\boldsymbol{\vec A}=\boldsymbol{\hat n}\,dA\). Since \(\boldsymbol{\hat n}\) is given, compute the dot product: \(\boldsymbol{\vec F}\cdot\boldsymbol{\hat n}=5\). Thus, the flux through the square is 5 times the area, namely \(5(2^2)=20\).
The plane lies at a 45-degree angle in the \(xz\)-plane, so along lines with \(y=\hbox{const}\), we have \(dy=0\) and \(dz=dx\), so \(d\boldsymbol{\vec{r}}_1 =dx\,\boldsymbol{\hat{x}}+dx\,\boldsymbol{\hat{z}}\). Along lines in the \(y\) direction, \(x\) and \(z\) are constant, so \(d\boldsymbol{\vec{r}}_2=dy\,\boldsymbol{\hat{y}}\). Therefore, \[d\boldsymbol{\vec{A}} =d\boldsymbol{\vec{r}}_1\times d\boldsymbol{\vec{r}}_2 =dx\,dy\,(\boldsymbol{\hat{x}}+\boldsymbol{\hat{z}})\times \boldsymbol{\hat{y}} =dx\,dy\,(\boldsymbol{\hat{z}}-\boldsymbol{\hat{x}}).\] Since the coefficient of \(\boldsymbol{\hat{z}}\) is positive, we have indeed chosen the correct orientation.
The flux integral now becomes \[\int_R \boldsymbol{\vec{H}}\cdot d\boldsymbol{\vec{A}} = \int_R \bigl((3+2z)-2z\bigr)\,dx\,dy = \int_0^2 \int_0^3 3\,dx\,dy = 18 . \]
This is a straightforward Gauss's Law problem: \begin{align} \oint \vec{E}\cdot \hat{n}\, dA &=\frac{1}{\epsilon_0} Q_{\text{enclosed}}\\ &=\frac{1}{\epsilon_0}\int_0^L \lambda_0 dz\\ &=\frac{1}{\epsilon_0}\lambda_0 L \end{align}
Consider an infinite positively charged (dielectric) cylindrical shell of inner radius \(a\) and outer radius \(b\) with a cylindrically symmetric internal charge density \(\rho(\vec r)=\alpha\, e^{(ks)^2}\).
Answer each of the following questions:
- By symmetry, the electric field only has a (cylindrical) radial component, and can only depend on the cylindrical radial coordinate \(s\), so \(\boldsymbol{\vec{E}}=E_s(s)\,\boldsymbol{\hat{s}}\). Choose the Gaussian surface to be a finite cylinder of height \(L\) and radius \(s\). Then the flux of \(\boldsymbol{\vec{E}}\) out of the cylinder is \[\int_C\boldsymbol{\vec{E}}\cdot d\boldsymbol{\vec{A}} = \int_C E_s(s)\,dA = 2\pi sLE_s\] The charge \(Q_{enc}\) in the region \(R\) inside the cylinder \(C\) is \[Q_{enc}=\int_R \rho\,d\tau\] so Gauss's Law tells us that \[E_s = \frac{Q_{enc}}{2\pi sL\epsilon_0}\]
- For \(s>b\), the enclosed charge is \[Q_{enc}=\int_0^{2\pi}\int_0^L\int_a^b \rho s\,ds\,dz\,d\phi = 2\pi L \int_a^b \alpha\,e^{(ks)^2}\,s\,ds = \frac{\pi L\alpha}{k^2} e^{(ks)^2}\bigg|_a^b\] so that \[E_s = \frac{\alpha}{2sk^2\epsilon_0}\left(e^{(kb)^2}-e^{(ka)^2}\right)\]
- For \(a<s<b\), the only thing that changes is the limits, and the enclosed charge is \[Q_{enc} = \frac{\pi L\alpha}{k^2} e^{(ks)^2}\bigg|_a^s\] so that \[E_s = \frac{\alpha}{2sk^2\epsilon_0}\left(e^{(ks)^2}-e^{(ka)^2}\right)\]
- For \(s<a\), \(Q_{enc}=0\), so \(E_s=0\).
- The quantity \(ks\) is dimensionless, and \(s\) has the dimensions of length, so \(k\) must have the dimensions of inverse length. Similarly, since \(\rho\) is a (volume) charge density, it has dimensions of \(\frac{\mathrm{charge}}{\mathrm{length}^3}\). Since the exponential factor must be dimensionless, these are also the dimensions of \(\alpha\).
Also setting \(a=1\), \(b=2\), and \(\epsilon_0=1\) yields a graph of the form below.
![]()