Consider an ellipse $\frac{x^2}{a^2}+\frac{y^2}{b^2} = 1$ such that $a>b$ and its parametrization
$$\vec{r}(\phi)=a\cos\phi\ \hat{x}+b\sin\phi\ \hat{y}$$
where $\phi\in[0,2\pi)$. Also consider a focus at $\vec{f}=c\ \hat{x}$, where $c^2=a^2-b^2$. The vector from the focus to a point on the ellipse is given by
$$\vec{d}=\vec{r}-c\hat{x} = (a\cos\phi\ -c)\hat{x}+b\sin\phi\ \hat{y}$$
It follows from the dot product that,
\begin{align} d^2 &= a^2\cos^2\phi + b^2\sin^2\phi +c^2 -2ca\cos\phi \\ &= r^2 +c^2 -2ca\cos\phi \end{align}
But in the triangle formed by the vectors, the Law of Cosines gives:
$$d^2 = r^2 +c^2 -2cr\cos\phi$$
This seems to imply that $r=a$, but that cannot always be true. Where has this argument gone astray?