# Finding $\int \frac{dx}{a+b \cos x}$ without Weierstrass substitution.

I saw somewhere on Math Stack that there was a way of finding integrals in the form $$\int \frac{dx}{a+b \cos x}$$ without using Weierstrass substitution, which is the usual technique.

When $a,b=1$ we can just multiply the numerator and denominator by $1-\cos x$ and that solves the problem nicely.

But I remember that the technique I saw was a nice way of evaluating these even when $a,b\neq 1$.

• The name "Weierstrass substitution" is unfortunate, since Weierstrass didn't have anything to do with it (Stewart's calculus book to the contrary notwithstanding). $\qquad$ – Michael Hardy Apr 14 '16 at 3:27

One usual trick is the substitution $x=2y$. Note that $$\frac{1}{a+b\cos(2y)}=\frac{1}{a+b(2\cos^2(y)-1)}=\frac{\sec^2(y)}{2b+(a-b)\sec^2(y)}=\frac{\sec^2(y)}{(a+b)+(a-b)\tan^2(y)}.$$ Hence $$\int \frac{dx}{a+b\cos(x)}=\int \frac{\sec^2(y)}{(a+b)+(a-b)\tan^2(y)} \, dy.$$ Now conclude with the substitution $t=\tan(y).$

• This is really the Weierstrass substitution since $t=\tan(x/2)$. – robjohn Apr 13 '16 at 9:29
• But at least not using directly :) – student forever Apr 13 '16 at 9:31
• @robjohn : No, it's not "really the Weierstrass" since call the tangent half-angle substitution "the Weierstrass substitution" is incorrect. James Stewart wasn't any good at history. – Michael Hardy Oct 2 '18 at 15:03

Kepler found the substitution when he was trying to solve the equation $$\ell=mr^2\frac{d\nu}{dt}=\text{constant}$$ where $\ell$ is the orbital angular momentum, $m$ is the mass of the orbiting body, the true anomaly $\nu$ is the angle in the orbit past periapsis, $t$ is the time, and $r$ is the distance to the attractor. This is Kepler's second law, the law of areas equivalent to conservation of angular momentum. Then Kepler's first law, the law of trajectory, is $$r=\frac{a(1-e^2)}{1+e\cos\nu}$$ where $a$ and $e$ are the semimajor axis and eccentricity of the ellipse. So to get $\nu(t)$, you need to solve the integral $$\int\frac{d\nu}{(1+e\cos\nu)^2}$$ So as to relate the area swept out by a line segment joining the orbiting body to the attractor Kepler drew a little picture

The attractor is at the focus of the ellipse at $O$ which is the origin of coordinates, the point of periapsis is at $P$, the center of the ellipse is at $C$, the orbiting body is at $Q$, having traversed the blue area since periapsis and now at a true anomaly of $\nu$. To perform the integral given above, Kepler blew up the picture by a factor of $1/\sqrt{1-e^2}$ in the $y$-direction to turn the ellipse into a circle.

The orbiting body has moved up to $Q^{\prime}$ at height $$y=\frac{a\sqrt{1-e^2}\sin\nu}{1+e\cos\nu}$$But still $$x=\frac{a(1-e^2)\cos\nu}{1+e\cos\nu}$$ Now he could get the area of the blue region because sector $CPQ^{\prime}$ of the circle centered at $C$, at $-ae$ on the $x$-axis and radius $a$ has area $$\frac12a^2E$$ where $E$ is the eccentric anomaly and triangle $COQ^{\prime}$ has area $$\frac12ae\cdot\frac{a\sqrt{1-e^2}\sin\nu}{1+e\cos\nu}=\frac12a^2e\sin E$$ so the area of blue sector $OPQ^{\prime}$ is $$\frac12a^2(E-e\sin E)$$ and then we can go back and find the area of sector $OPQ$ of the original ellipse as $$\frac12a^2\sqrt{1-e^2}(E-e\sin E)$$ So if doing an integral with a factor of $\frac1{1+e\cos\nu}$ via the eccentric anomaly was good enough for Kepler, surely it's good enough for us.

In the original integer, $$\int\frac{dx}{a+b\cos x}=\frac1a\int\frac{dx}{1+\frac ba\cos x}=\frac1a\int\frac{d\nu}{1+\left|\frac ba\right|\cos\nu}$$ where $\nu=x$ is $ab>0$ or $x+\pi$ if $ab<0$. Now we see that $e=\left|\frac ba\right|$, and we can use the eccentric anomaly, $$\sin E=\frac{\sqrt{1-e^2}\sin\nu}{1+e\cos\nu}$$ $$\cos E=\frac{\cos\nu+e}{1+e\cos\nu}$$ $$d E=\frac{\sqrt{1-e^2}}{1+e\cos\nu}d\nu$$ and the integral reads \begin{align}\int\frac{dx}{a+b\cos x}&=\frac1a\int\frac{d\nu}{1+e\cos\nu}=\frac12\frac1{\sqrt{1-e^2}}\int dE\\ &=\frac1a\frac1{\sqrt{1-e^2}}E+C=\frac{\text{sgn}\,a}{\sqrt{a^2-b^2}}\sin^{-1}\left(\frac{\sqrt{a^2-b^2}\sin\nu}{|a|+|b|\cos\nu}\right)+C\\&=\frac{1}{\sqrt{a^2-b^2}}\sin^{-1}\left(\frac{\sqrt{a^2-b^2}\sin x}{a+b\cos x}\right)+C\end{align} Of course it's a different story if $\left|\frac ba\right|\ge1$, where we get an unbound orbit, but that's a story for another bedtime.

• How can Kepler know calculus before Newton/Leibniz were born ? – A---B Mar 16 '17 at 12:33

Another way to get to the same point as C. Dubussy got to is the following: \begin{align*} \frac{1}{a + b \cos x} &= \frac{1}{a \left (\cos^2 \frac{x}{2} + \sin^2 \frac{x}{2} \right ) + b \left (\cos^2 \frac{x}{2} - \sin^2 \frac{x}{2} \right )}\\ &= \frac{1}{(a - b) \sin^2 \frac{x}{2} + (a + b) \cos^2 \frac{x}{2}}\\ &= \frac{\sec^2 \frac{x}{2}}{(a + b) + (a - b) \tan^2 \frac{x}{2}}, \end{align*} and then make the substitution of $t = \tan \frac{x}{2}$ in the integral.

• NAILED IT !!!!!!!!!!!!!!!!!!!!!!! – user589548 Oct 2 '18 at 15:01

If the integral is a definite integral (typically from $0$ to $\pi/2$ or some other variants of this), then we can follow the technique here to obtain the integral. The key ingredient is to write $\dfrac1{a+b\cos(x)}$ as a geometric series in $\cos(x)$ and evaluate the integral of the sum by swapping the integral and the summation.

If $a=b$ then you can modify the technique for $a=b=1$ slightly to obtain:

$\int \frac{dx}{b+b\cos x}=\int\frac{b-b\cos x}{(b+b\cos x)(b-b\cos x)}dx$

$=\int\frac{b-b\cos x}{b^2-b^2\cos^2 x}dx=\int\frac{b-b\cos x}{b^2(1-\cos^2 x)}dx=\frac{1}{b}\int\frac{1-\cos x}{\sin^2 x}dx$

Splitting the numerator, and further simplifying:

$\frac{1}{b}\int\frac{1}{\sin^2 x}dx-\frac{1}{b}\int\frac{\cos x}{\sin^2 x}dx=\frac{1}{b}\int\csc^2 x\:dx-\frac{1}{b}\int\frac{\cos x}{\sin^2 x}dx$

The integral on the left is $-\cot x$ and the one on the right is an easy $u$-sub with $u=\sin x$.

So what happens with $a\neq b$?

$\int \frac{dx}{a+b\cos x}=\int\frac{a-b\cos x}{(a+b\cos x)(a-b\cos x)}dx=\int\frac{a-b\cos x}{a^2-b^2\cos^2 x}dx$

Now, add and subtract $b^2$ to the denominator and group the $+b^2$ with $-b^2\cos^2x$.

$=\int\frac{a-b\cos x}{a^2-b^2+b^2-b^2\cos^2 x}dx=\int\frac{a-b\cos x}{(a^2-b^2)+b^2(1-\cos^2 x)}dx$

Split the numerator again, and use pythagorean identity.

$\int\frac{a-b\cos x}{(a^2-b^2)+b^2(\sin^2 x)}dx$

and here I am stuck.