# Trouble deriving rectangular components of acceleration of satellite in orbit around Earth with J2 consideration

I am trying to derive the rectangular components of acceleration for a satellite in orbit, with Earth oblateness in consideration, in order to use the RK4 method to find the updated position and velocity of the satellite. I am aware that there are equations already out there, but I want to know how they were derived. However, my solutions don't exactly look like those equations - more importantly, the power of r in those sets of equations and in the wikipedia force equations are not the same. These equations have $$\frac{1}{r^7}$$, while mine have $$\frac{1}{r^6}$$

I will show how I derived the equations, please let me know if I've made an error!

I am using the following equation that I grabbed from the NASA Flight Test Cases document and Fonte 1993 (Implementation of 50x50 Gravity Field Model):

$$U = -\frac{\mu }{r}\left [ 1+\sum_{n=2}^{\infty}\sum_{m=0}^{n}\left(\frac{ R_{e}}{r}\right)^{n}P_{n,m}(sin\phi )\left(C_{n,m}cos(m\lambda) +S_{n,m}sin(m\lambda ) \right)\right]$$

I knew that for zonal harmonics $$m=0$$, so the equation looks like $$U = -\frac{\mu }{r}\left[1+\sum_{n=2}^{\infty}\left(\frac{R_{e}}{r}\right)^{n}P_{n,0}(sin\phi )(C_{n,0}cos(0) )\right]$$

I will then solve for $$n=2$$ knowing that $$C_{n,0}=J_{2}$$

There is a section below equation 10 under the deviations of Earth's gravitational field from that of a homogenous sphere section of the Geopotential Wiki page that says

$$u=\frac{J_{2}P_{2}^{0}(sin\theta )}{r^3}=J_{2}\frac{1}{r^3}\frac{1}{2}(3sin^{2}\theta-1)=J_{2}\frac{1}{r^5}\frac{1}{2}(3z^{2}-r^{2})$$

So I deduced that

$$P_{2,0}=\frac{1}{r^2}\frac{1}{2}(3z^{2}-r^{2})$$

So the equation looks like

$$U = -\frac{\mu }{r}\left[1+\left(\frac{R_{e}}{r}\right)^{2}(J_{2} )\left(\frac{1}{r^2}\frac{1}{2}\left(3z^{2}-r^{2}\right)\right)\right]$$

I then multiplied everything out and put the equation in this form

$$U = -\mu\left[\frac{1 }{r}+\frac{3}{2}J_{2}R_{E}^{2}z^{2}\frac{1 }{r^5}-\frac{1}{2}J_{2}R_{E}^{2}\frac{1 }{r^3}\right]$$

Knowing that $$F_{x} = -\frac{\partial U}{\partial x}$$, and using $$\frac{\partial }{\partial x}r^{-5}=\frac{\partial }{\partial x}(x^{2}+y^{2}+z^{2})^{-5}=-\frac{10x}{r^6}$$ etc., and then rearranging, I got the following for the x (and y) component:

$$F_{x} = -\frac{\partial U}{\partial x} = -\frac{\mu x}{r^2}\left[2+\frac{3J_{2}R_{E}^{2}}{r^2}\left(\frac{5z^{2}}{r^2}-1\right)\right]$$

Which looks somewhat familiar to this, but is not it exactly. I've tried doing that math three times now and get the same answer.

Sidenote: I asked OP of that thread, and he said that he got those equations from Section 7A of this competition

Can anyone tell me what I'm doing wrong?

• It looks like you are almost there! Have a look at the section about $J_2$ in this answer which comes from here. If it's what you need, you are welcome to answer your own question and pick up a few reputation points. Another option would be to nominate your question as duplicate to that question. Here duplicate means that your question is answered there, not that the questions are identical. Welcome to Space! – uhoh May 14 '19 at 0:13
• @uhoh Thank you for your reply. In all honesty, the J2 expressions on that answer have me a little more confused. For example where did the x^2 and y^2 terms come from and where is the rE for that equation? R is to the magnitude of -7 in those equations while it is only to the magnitude of -6 in my equations (maximum). The 3/2 term from space.stackexchange.com/questions/24724/… seems to correspond to the 1.5 in those equations, but are multiplied by different terms? – arah May 14 '19 at 0:41
• okay I will have a closer look right now, I'm just having my morning coffee and need a minute for it to kick in. The linked equations work (they reproduce apsidal precession, have the correct units, etc.) unless there's a typo. $R_E$ is a standard Earth radius used along with the product $GM$ (also written as $\mu$) to generate the dimensionless form of $J_2$. – uhoh May 14 '19 at 0:49
• @uhoh Morning coffee with two sugars and a side of spherical harmonics coming up. Yes, I'm quite sure that I'm doing something wrong or forgetting to do something. I'm just new to this field and would like to be able to derive that equation correctly so I know how to do the higher order terms later, or so I can take apart other equations into its xyz components to integrate. Now that you mention the dimensionless form of J2, could the J2 in the equations you linked me have dimensions? Which is why those equations look different? – arah May 14 '19 at 0:53
• okay I've posted an answer. It's as far as I'll go but I think you can take it from there! I can't yet guarantee that there isn't a minus sign error somewhere, I'll try to check it again later in the day. – uhoh May 14 '19 at 2:08

$$U = -\mu\left[\frac{1 }{r}+\frac{3}{2}J_{2}R_{E}^{2}z^{2}\frac{1 }{r^5}-\frac{1}{2}J_{2}R_{E}^{2}\frac{1 }{r^3}\right]$$

can be rewritten as

$$U = -\mu\left[\frac{1 }{r} + \frac{1}{2}J_{2}R_{E}^{2} \left(3\frac{z^2}{r^5}-\frac{1}{r^3}\right)\right]$$

where $$U$$ is the reduced potential (the potential of a body of mass $$m$$ is then $$mU$$) and use

$$\mathbf{a}=\nabla U = \frac{\partial U}{\partial x} \mathbf{\hat{x}} + \frac{\partial U}{\partial y} \mathbf{\hat{y}} \frac{\partial U}{\partial z} \mathbf{\hat{z}} = a_x \mathbf{\hat{x}} + a_y \mathbf{\hat{y}} + a_z \mathbf{\hat{z}}$$

to get the acceleration. I'll do the x component with a little help from Wolfram alpha:

$$\frac{\partial}{\partial x} \frac{1}{r} = -\frac{x}{r^3},$$

$$\frac{\partial}{\partial x} \frac{z^2}{r^5} = -\frac{5xz^2}{r^7},$$

$$\frac{\partial}{\partial x} \frac{1}{r^3} = -\frac{3x}{r^5}.$$

Put those back into $$\partial U/ \partial x$$ and you get:

$$-\mu\left[ -\frac{x}{r^3} + \frac{x}{2}J_{2}R_{E}^{2} \left(-3 \frac{5z^2}{r^7} +\frac{3}{r^5}\right)\right]$$

$$-\mu\left[ -\frac{x}{r^3} + \frac{x}{2}J_{2}R_{E}^{2} \left(-3 \frac{5z^2}{r^7} +\frac{3r^2}{r^7}\right)\right]$$

$$-\mu\left[ -\frac{x}{r^3} + \frac{x}{2}J_{2}R_{E}^{2} \left(-3 \frac{5z^2}{r^7} +\frac{3(x^2 + y^2 + z^2)}{r^7}\right)\right]$$

At this point I'll leave it as an exercise for the reader to combine terms and arrive at

$$a_x = -GM \frac{\mathbf{x}}{|r|^3} + GM R_E^2 J_2 \frac{x}{|r|^7} (6z^2 - 1.5(x^2+y^2))$$

using $$r^2=x^2+y^2+z^2$$, the math and links in this answer plus the relationship between the dimensional and dimensionless (normalized, unitless) forms of $$J_2$$ described in For the mathematical relationship between J2 (km^5/s^2) and dimensionless J2 - which one is derived from the other? noting that $$\mu$$ is (at least in this case) just another name for the product $$GM$$.

• Thank you for your reply. I am having trouble with how you did the partial derivatives. The partial of r with respect to x is supposed to be -2x/r^2, and this. I thought that when you take a derivative you only subtract one from the power and not two. Is there any reason why you subtracted two? – arah May 14 '19 at 3:10
• @arah Here's how to think about that. The units of $1/r$ are $length^ {-1}$ and so the derivative with respect to $length$ better have units of $length^{-2}$. As I mentioned in the answer I used Wolfram Alpha to help with the derivative, but you can do it easily if you remember that $r=\sqrt{x^2 + y^2 + z^2}$ and do it that way. Write $\partial \sqrt{x^2 + y^2 + z^2}/\partial x = \partial (x^2 + y^2 + z^2)^{1/2}/\partial x$ and go from there using the chain rule. – uhoh May 14 '19 at 3:27
• @arah The expression in your first link is $\frac{\partial}{\partial x} \frac{1}{r^2}$, not $\frac{\partial}{\partial x} \frac{1}{r}$, since $r$ is $\sqrt{x^{2}+y^{2}+z^{2}}$, not $x^{2}+y^{2}+z^{2}$. Similarly, $\frac{\partial }{\partial x}r^{-5}$ is $\frac{\partial }{\partial x}(x^{2}+y^{2}+z^{2})^{-5/2}=-\frac{5x}{r^7}$, not $\frac{\partial }{\partial x}(x^{2}+y^{2}+z^{2})^{-5}=-\frac{10x}{r^6}$. – Litho May 14 '19 at 8:13
• Hi yes, I realized that I forgot to add the squareroot! Thank you. – arah May 14 '19 at 15:12
• @arah thanks for the edit! – uhoh May 14 '19 at 16:53