Physics Help Forum Gauss's law using a cube

 Electricity and Magnetism Electricity and Magnetism Physics Help Forum

 May 20th 2017, 12:46 PM #1 Senior Member   Join Date: Nov 2013 Location: New Zealand Posts: 548 Gauss's law using a cube I thought I would try and verify Gauss's law for a cube of sides length a, centred at the origin, just for fun. I didn't include the cross-product term in the surface integral as far as I can tell it equals unity anyway. The 3/2 power term comes from combining with the vector projection of the flux onto the area vector of the cube. The projection factor was as follows: $cos \alpha = \frac{a/2}{\sqrt {(a/2)^2+x^2+y^2)}}$ I came up with this surface integral. $\int_{-1/a}^{1/a} \int_{-1/a}^{1/a} \frac{Q_{inside} \times (a/2)^{2}}{4 \pi \epsilon_0 ((a/2)^2+x^2+y^2)^\frac{3}{2}}dxdy$ Using wolfram alpha I got this to evaluate to: $\frac {Q_{inside}}{2 \pi \epsilon_0} a \tan^{-1}\left ( \frac{1}{a \sqrt{\frac{1}{a^2}+\frac{a^2}{2}}} \right )$ This is for one face of the cube so need to multiply that by 6 for each face. However Gauss's law is supposed to be independent of shape and here it seems dependent upon the size of the box!! I have a feeling I may be mixing up surface and volume integrals. Am I missing an obvious surface parameterization here? However surface integrals always seem to be double and if anything this should be simpler than a sphere (which I worked through previously). I should add that I evaluated this integral between 0 and a/2 and doubled the result rather than integrating between -a/2 and a/2 because the latter always evaluated to zero. The problem seems to be any integral of an even function evaluates to zero around equal and opposite upper and lower bounds. I know it shouldn't be zero so I did the former which probably means I set this problem up incorrectly but I can't quite see why. This is the answer I was expecting: $\frac {Q_{inside}}{ 6 \epsilon_0}$ Can anyone see any obvious mistakes I have made? Last edited by kiwiheretic; May 20th 2017 at 04:49 PM. Reason: Clean up last eqn
May 21st 2017, 06:24 AM   #2
Senior Member

Join Date: Aug 2010
Posts: 384
You say
 I should add that I evaluated this integral between 0 and a/2 and doubled the result rather than integrating between -a/2 and a/2
but the integral you show is from -1/a to 1/a. Where did that come from?

 The problem seems to be any integral of an even function evaluates to zero around equal and opposite upper and lower bounds.
No, it isn't. The integral of any odd function is even, F(-a)= F(a), so that F(a)- F(-a)= F(a)- F(a)= 0. Then integral of any even function is odd, F(-a)= -F(a), so that F(a)- F(-a)= F(a)+ F(a)= 2F(a).

May 21st 2017, 01:53 PM   #3
Senior Member

Join Date: Nov 2013
Location: New Zealand
Posts: 548
 Originally Posted by HallsofIvy You say but the integral you show is from -1/a to 1/a. Where did that come from?
The cube is centered at the origin with vertices at co-ordinates (1/a,1/a,1/a), (1/a,1/a,-1/a), (1/a,-1/a,1/a), (1/a,-1/a,-1/a), (-1/a,1/a,1/a), (-1/a,1/a,-1/a), (-1/a,-1/a,1/a), (-1/a,-1/a,-1/a).

I tried to cheat by calculating one face of the cube only thinking to multiply by 6 afterwards. (cube has 6 faces). I also tried to cheat by dividing a face into four quadrants, ie (x positive, y positive), (x, negative, y positive), (x positive, y negative) and (x negative, y negative). I chose to evaluate with 0 < x < 1/a and 0 < y < 1/a for both positive thinking to multiply the result by 4 as there are 4 quadrants. In other words using symmetry arguments where ever possible.

 No, it isn't. The integral of any odd function is even, F(-a)= F(a), so that F(a)- F(-a)= F(a)- F(a)= 0. Then integral of any even function is odd, F(-a)= -F(a), so that F(a)- F(-a)= F(a)+ F(a)= 2F(a).
Well, if we use an even function like y = x^2 as an example and evaluate it around -1 < x < 1 then I(Y(x)) = x^3/3 where I(Y(1)) - I(y(-1)) = 1/3 - - 1/3 = 2/3. Ohhh, oops. That's what happens when I try to do this too late at night to battle insomnia. ;-)

I tried again but leaving out the constant factor

$\frac{Q_{inside} \times a }{8 \pi \epsilon_0 }$

for brevity.

$\int \frac{dx}{\left ( \frac{a^2}{4}+x^2+y^2 \right )^\frac{3}{2}} = \frac{8x}{(a^2+4y^2)\sqrt {a^2+4(x^2+y^2)}}$

Then integrating with respect to y

$\int \frac{8x dy}{(a^2+4y^2)\sqrt {a^2+4(x^2+y^2)}} = \frac{2 \tan^{-1} {\left ( \frac{4xy}{a \sqrt {a^2 +4(x^2+y^2)}} \right )}}{a}$
substituting x=1/a for the result and doubling it this time because when we substitute for x = -1/a we are same but for a sign but then we also subtract the two.

$2 \times \frac{\frac{8}{a}}{(a^2+4y^2)\sqrt {a^2+\frac{4}{a^2}+4y^2}}$

substituting in x = 1/a yields

$\frac{2 \tan^{-1} {\left ( \frac{4y}{a^2 + \sqrt {4 \left ( \frac{1}{a^2} + y^2 \right ) + a^2}} \right )}}{a}$

and x = -1/a yields

$- \frac{2 \tan^{-1} {\left ( \frac{4y}{a^2 + \sqrt {4 \left ( \frac{1}{a^2} + y^2 \right ) + a^2}} \right )}}{a}$

yielding

$\frac{4 \tan^{-1} {\left ( \frac{4y}{a^2 + \sqrt {4 \left ( \frac{1}{a^2} + y^2 \right ) + a^2}} \right )}}{a}$

which is where I think SymPy Live led me up the garden path by telling me it was zero.

Doing the same for y = 1/a

$\frac{4 \tan^{-1} {\left ( \frac{4}{a^3 \sqrt { \frac{8}{a^2} + a^2}} \right )}}{a}$

and y = -1/a

$- \frac{4 \tan^{-1} {\left ( \frac{4}{a^3 \sqrt { \frac{8}{a^2} + a^2}} \right )}}{a}$

this time yielding

$\frac{8 \tan^{-1} {\left ( \frac{4}{a^3 \sqrt { \frac{8}{a^2} + a^2}} \right )}}{a}$

Ok, that's a lot better than what I had but we still get the total flux is dependent on the area of the sides of the cube and not just the charge inside according to what Gauss's law says so what am I missing here?

Last edited by kiwiheretic; May 21st 2017 at 03:02 PM.

 May 21st 2017, 03:31 PM #4 Senior Member   Join Date: Nov 2013 Location: New Zealand Posts: 548 Ooops, my cube corners are wrong, should be (a/2,a/2,a/2), (a/2,a/2,-a/2),(a/2,-a/2,a/2),(a/2,-a/2,-a/2),(-a/2,a/2,a/2),(-a/2,a/2,-a/2),(-a/2,-a/2,a/2),(-a/2,-a/2,-a/2) Now when I substitute in integration limits -a/2 < x < a/2 and -a/2 < y < a/2 I get: $\frac{8 \tan^{-1} {\left ( \frac{1}{\sqrt{3}} \right )}}{a}$ and that "a" term cancels out with the factor in $\frac{Q_{inside} \times a }{8 \pi \epsilon_0 }$ Ok, looks like I was half asleep when I was trying to do this last time. Looks like I solved it on my own (with some prompting from HallsofIvy). :-)
 May 21st 2017, 03:33 PM #5 Senior Member   Join Date: Nov 2013 Location: New Zealand Posts: 548 I wonder what that "tan" expression represents in this case.

 Tags cube, gauss, law

 Thread Tools Display Modes Linear Mode

 Similar Physics Forum Discussions Thread Thread Starter Forum Replies Last Post dieselfuel Thermodynamics and Fluid Mechanics 1 Apr 23rd 2017 02:27 AM morrobay Thermodynamics and Fluid Mechanics 1 Nov 24th 2011 01:02 AM Mike_mara Advanced Electricity and Magnetism 1 Dec 9th 2010 03:02 AM maple_tree Electricity and Magnetism 1 May 2nd 2010 10:28 PM maple_tree Advanced Electricity and Magnetism 4 Mar 30th 2010 11:15 AM