The flux of a vector field through a cylinder. 
The question is by using Gauss’ Theorem calculate the flux of the
  vector field
$\overrightarrow{F} = x \hat{i} + y \hat{j}+ z \hat{k}$
through the surface of a cylinder of radius A and height H, which has
  its axis along the z-axis and the base of the cylinder is on the
  xy-plane.

So, first of all I converted the vector field into cylindrical coordinates
$\overrightarrow{F}= \rho \cos^2 \phi \hat{e}_\rho + \rho \sin^2 \phi \hat{e}_\rho + z \hat{e}_z $ 
which can be further reduced to-
$\overrightarrow{F}= \rho \hat{e}_\rho + z \hat{e}_z$
The  surface of the cylinder has three parts, $ \ S_1 $, $ \ S_2 $, and $ \ S_3 $. $ \ S_1 $ and $ \ S_2 $ are the top and bottom of surface of the cylinder and $ \ S_3 $ is the curved surface. We can write the surface integral over the surface of the cylinder as
$\unicode{x222F}_S \overrightarrow{F} . d\overrightarrow{S}=\iint_{S_1} \overrightarrow{F} . d\overrightarrow{S_1} +\iint_{S_2} \overrightarrow{F} . d\overrightarrow{S_2} + \iint_{S_3} \overrightarrow{F} . d\overrightarrow{S_3}  $
As the area element is in $\rho \phi$ plane (for a constant value of z) has the value $\rho d \rho d \phi$. So an area element on $ \ S_1 $ and $ \ S_2 $ will have magnitude $\rho d \rho d \phi$, and the outward unit normals to $ \ S_1 $ and $ \ S_2 $ are then $ \hat{e}_z$  and $- \hat{e}_z$, respectively
$\therefore d\overrightarrow{S_1}= \rho d \rho d \phi \hat{e}_z$ and $d\overrightarrow{S_2}= -\rho d \rho d \phi \hat{e}_z$
And the area element for the $d\overrightarrow{S_3}= \rho dz d \phi \hat{e}_ \rho $
Now, keeping the conditions in mind-
$0 \le \rho \le A$ ; $0 \le \phi \le 2 \pi$; $0 \le z \le H$
$\unicode{x222F}_S \overrightarrow{F} . d\overrightarrow{S}=\iint_{S_1} [\rho \hat{e}_\rho + z \hat{e}_z].[\rho d \rho d \phi \hat{e}_z]+ \iint_{S_2} [\rho \hat{e}_\rho + z \hat{e}_z].[-\rho d \rho d \phi \hat{e}_z]+ \iint_{S_3} [\rho \hat{e}_\rho + z \hat{e}_z].[\rho dz d \phi \hat{e}_ \rho]$
The flux of $d\overrightarrow{S_1}$ and $ d\overrightarrow{S_2}$ will cancel  out each other. Now, integrating $\iint_{S_3} \overrightarrow{F} . d\overrightarrow{S_3}  $ as double integral-
$\int _{\phi =0}^{2\pi }\:\int _{z=0}^H\:\rho^2 dz d \phi$
$= 2 \pi A^2 H$   where $\rho = A$
So, the total flux is $= 2 \pi A^2 H$ which I think is wrong, as the flux should be the curved surface area of the cylinder,i.e., $= 2 \pi A H$
I am still learning this topic, so please mention any mistake that I've done while solving it
 A: I think switching to cylindrical coordinates makes things way too complicated. It also seems to me you ignored the instructions to apply Gauss's Theorem. From the cartesian coordinates, we see immediately that $\text{div}\, \vec F = 3$, so the flux across the entire closed surface will be $3(\pi A^2H)$. The flux of $\vec F$ downwards across the bottom, $S_2$, is $0$ (since $z=0$); the flux of $\vec F$ upwards across the top, $S_1$, is $H\cdot(\pi A^2)$. Thus, the flux across the cylindrical surface $S_3$ is $2\pi A^2H$. 
Your intuition is a bit off, because you need another factor of $A$ (since $\vec F$ is $A$ times the unit radial vector field). By the way, using $A$ for a radius is very confusing, as most of us would expect $A$ to denote area.
A: You need to watch out for three specific things here.
1) Calculating the flux through any object that has more than one distinct surface becomes highly tedious. This is why we use Gauss' Theorem and that is why the question is asking you to use it.
Gauss' Theorem states that:
Total Flux Through Object $=\iint_S \overrightarrow{F} \cdot \overrightarrow{n} dS = \iiint_D div \overrightarrow{F} dV$
You will notice that there are two ways to calculate the total flux. The "LHS version" and the "RHS version". You are using the "RHS Version", and need to use the "LHS Version".
In general though, Gauss' theorem is not a Panacea for all problems involving calculating the flux. A sufficient condition to use it is in instances where:


*

*D is a closed, bounded region in $R^3$ with a piecewise smooth outer
surface S, oriented outward

*F is a smooth 3-dimensional vector field


2) Keep your vector field in Cartesian co-ordinates - it is not necessary to convert it. However, naturally, your cylinder will need to be in cylindrical co-ordinates (see below).
3) The triple integral is integrated, in order from outer to inner intergal bound, the rotation, the radius and the height. The form of the equation in the integrand is:
$\iiint r \cdot dzdrd\theta$
