I want to get the polar equation for a ellipse in polar form with the center at one of the foci. I started with the equation of an ellipse in Cartesian coordinates:

$\displaystyle \frac{x^2}{a^2}+\frac{y^2}{b^2}=1$

Using $\displaystyle x=rcos\theta$ and $\displaystyle y=rsin\theta$ I obtained:

$\displaystyle \frac{r^2cos^2\theta}{a^2}+\frac{r^2sin^2\theta}{b ^2}=1$

$\displaystyle b^2r^2cos^2\theta+a^2r^2sin^2\theta=a^2b^2$

$\displaystyle r^2(b^2cos^2\theta+a^2sin^2\theta)=a^2b^2$

$\displaystyle r=\frac{ab}{\sqrt{(b^2cos^2\theta+a^2sin^2\theta)} }$

Now I would like the same thing but centered at a focus:

From wiki, I found that the distance between the foci is $\displaystyle \sqrt{a^2-b^2}$. I not sure why that is the case and it would be nice to see some proof. Then I reasoned the ellipse must be shifted half that distance as below:

$\displaystyle \frac{(x-\frac{\sqrt{a^2-b^2}}{2})^2}{a^2}+\frac{y^2}{b^2}=1$

$\displaystyle \frac{x^2+\frac{a^2-b^2}{4}-\sqrt{a^2-b^2}}{a^2}+\frac{y^2}{b^2}=1$

$\displaystyle \frac{x^2}{a^2}+\frac{1}{4}(1-\frac{b^2}{a^2})-\frac{1}{a}\sqrt{1-\frac{b^2}{a^2}}+\frac{y^2}{b^2}=1$

Using the identity $\displaystyle e=\sqrt{1-\frac{b^2}{a^2}}$ I obtained:

$\displaystyle \frac{x^2}{a^2}+\frac{e^2}{4}-\frac{e}{a}+\frac{y^2}{b^2}=1$

$\displaystyle \frac{r^2cos^2\theta}{a^2}+\frac{e^2}{4}-\frac{e}{a}+\frac{r^2sin^2\theta}{b^2}=1$

$\displaystyle \frac{r^2cos^2\theta}{a^2}+\frac{r^2sin^2\theta}{b ^2}=\frac{e}{a}-\frac{e^2}{4}$

$\displaystyle r^2\frac{a^2sin^2\theta+b^2cos^2\theta}{a^2b^2}=\f rac{e(4-ae)}{4a}$

$\displaystyle r^2=\frac{e(4-ae)}{4a}\frac{a^2b^2}{a^2sin^2\theta+b^2cos^2\thet a}$

$\displaystyle r^2=\frac{e(4-ae)}{4}\frac{ab^2}{a^2(1-cos^2\theta)+b^2cos^2\theta}$

$\displaystyle r^2=\frac{e(4-ae)}{4}\frac{ab^2}{a^2-(a^2-b^2)cos^2\theta}$

$\displaystyle r^2=\frac{e(4-ae)}{4}\frac{\frac{b^2}{a}}{1-\frac{a^2-b^2}{a^2}cos^2\theta}$

$\displaystyle r^2=\frac{e(4-ae)}{4}\frac{\frac{b^2}{a}}{1-e^2cos^2\theta}$

I'm kindda stuck here. I know that I should get something like $\displaystyle r=\frac{a(1-e^2)}{1+ecos\theta}$

Therefore:

$\displaystyle r^2=\frac{a^2(1-2e^2+e^4)}{1+e^2cos^2\theta+2ecos\theta}$

Where will the $\displaystyle cos\theta $ term came from? and the $\displaystyle e^4$? Am I on the right track?

Am I doing something wrong?