\documentclass[12pt]{article} % BB Oct 12 2011.
\usepackage{epsfig}
\textheight 9.0in \textwidth  6.0in \topmargin -0.4in \headsep 0.4in  
\oddsidemargin  0.25in  \evensidemargin 0.25in  

\def\sqr#1#2{{\vcenter{\hrule height.#2pt
   \hbox{\vrule width.#2pt height#1pt \kern#1pt
   \vrule width.#2pt} \hrule height.#2pt}}}
\def\square{{\mathchoice\sqr64\sqr64\sqr{4.2}3\sqr{3.0}3}}
\def\undertext#1{$\underline{\smash{\hbox{#1}}}$}
\pagestyle{empty}

\begin{document}

\centerline{Solution for assignment 20: Kepler Ellipse.} \bigskip 

Rewritten and using $\cos\theta=x/r$, the initial equation becomes
$$ p = r\,(1+e\,\cos\theta) = r\,(1+e\,x/r) = r + e\,x~~{\rm or}
 ~~r = p - e\,x\,. $$
Squaring both sides
$$ x^2 + y^2 = p^2 -2\,p\,e\,x + e^2\,x^2\,. $$
Bringing all terms with $x$ or $y$ to one side,
$$ x^2\,(1-e^2) + 2\,p\,e\,x + y^2 = p^2\,, $$
$$ x^2 + \frac{2\,p\,e}{1-e^2}\,x + \frac{y^2}{1-e^2} 
   = \frac{p^2}{1-e^2}\,, $$
According to the recipe for completion of the square we substitute
$$ x' = x + \frac{p\,e}{1-e^2} $$ 
and obtain
$$ x'{\,^2}\, + \frac{y^2}{1-e^2} = \frac{p^2}{1-e^2}
 + \left(\frac{p\,e}{1-e^2}\right)^2 =
   \frac{p^2\,(1-e^2) + p^2\,e^2}{(1-e^2)^2} = 
   \frac{p^2}{(1-e^2)^2}\,,  $$ 
$$ x'{\,^2}\, \frac{(1-e^2)^2}{p^2} +y^2 \frac{1-e^2}{p^2} = 1\,. $$ 
With the definitions 
$$ a=\frac{p}{1-e^2}~~~{\rm and}~~~b=\frac{p}{\sqrt{1-e^2}}  $$ 
this reads
$$ \left(\frac{x'}{a}\right)^2 + \left(\frac{y}{b}\right)^2 = 1\,. $$ 
\end{document}
