# How is the equation for non-spherical gravitational accelerations derived?

I am referencing Vallado (4th edition) to understand the acceleration contributions on a spacecraft due to non-spherical gravitational effects. Generally, I understand this derivation, except for how to calculate the partial derivative of the potential function with respect to latitude. I went to Vallado's source to see how the partial derivatives were calculated, and equation 4-31b is still a mystery to me:

I'm not sure how this result was obtained by simple chain rule, even after referencing the subsequent equations. I would expect the term on the second line to simply be P_n^(m+1) * sin(phi) * P_n^m * cos(phi). Clearly I'm missing something.

It's a matter of convention: What does $$\phi$$ represent?

tl;dr

If $$\phi$$ represents the polar angle of the point in question then one should use $$\cos \phi$$. If on the other hand, $$\phi$$ represents the geocentric latitude of the point in question, then one should use $$\sin \phi$$.

Details

The angle between the North Pole and the vector from the center of the Earth to the point in question is called the polar angle of that point, aka colatitude. The angle between Earth's equatorial plane and the vector from the center of the Earth to the point in question is called thee geocentric latitude. Note that the polar angle and geocentric latitude always sum to 90° (or to $$pi/2$$ if one uses radians, which is mathematically preferable to using degrees). Because of this, if one denotes $$\phi$$ as the polar angle and $$\theta$$ as the geocentric latitude, then $$\cos \phi \equiv \sin \theta$$ (and $$\sin \phi \equiv \cos \theta$$).

Laplace's mathematical development of spherical harmonics used polar angle. This is the convention that most physicists and mathematicians continue to use to this day. Most derivations you will see in textbooks and on the internet use this convention. These derivations inevitably are chock full of $$P_{l,m}(\cos \phi)$$ terms, where $$\phi$$ is the polar angle.

Gravity modelers tend to prefer to use latitude instead of polar angle. You will thus see $$\sin \phi$$ terms in the description of how to use those normalized spherical harmonics gravity coefficients, where $$\phi$$ now represents the geocentric latitude.

The solution is easy: Carefully read the documentation to determine which convention being used.