I'm learning the basics of vector calculus when I came across this problem:
A point charge +q is located at the origin of the coordinate system. Calculate the flux of the electric field due to this charge through the plane $z = +z_0$ by explicitly evaluating the surface integral. Convert the open surface integral into a closed one by adding a suitable surface(s) and then obtain the result using Gauss' divergence theorem.
I have no problem in solving the first part (i.e) by direct integration of the surface integral. I got the answer as $q/2\epsilon_0$, which I know is the correct answer as it can also be obtained using the solid angle formula.
But the problem is when I proceed to calculate the divergence of the electic field and then do the volume integral I run into an undefined answer. I converted the open surface into a closed volume by adding another plane at $z = -z_0$.
I'm attaching my work below:
Can someone help me out on where I made a mistake?