Find the equation of an ellipse given its focus, directrix and eccentricity

Ellipse has a focus $(3;0)$, a directrix $x+y-1=0$ and an eccentricity of $1/2$. Find its equation.

I should probably use the fact that $r/d = e$, where $r$ is the distance from the focus to any point $M(x,y)$ of an ellipse. $d$ the distance from $M(x,y)$ to the directrix, and $e$ is the eccentricity. However my attempt failed.

-

I should probably use the fact that $r/d = e$, where $r$ is the distance from the focus to any point $M(x,y)$ of an ellipse. $d$ the distance from $M(x,y)$ to the directrix, and $e$ is the eccentricity.

If you showed your attempt to begin with, we might be able to be a bit more helpful; alas, since you haven't shown it, you'll have to content yourself with the following sketch of a solution.

You know the distance from an arbitrary point $(x,y)$ to the focus $(3,0)$:

$$f=\sqrt{(x-3)^2+(y-0)^2}$$

and you can use the formula for point-line distance (formula 11 here) to get the distance from $(x,y)$ to the line $x+y-1=0$:

$$d=\frac{x+y-1}{\sqrt{1^2+1^2}}$$

from which you use the definition for eccentricity, $\varepsilon=\dfrac{f}{d}$, where $\varepsilon=\dfrac12$.

At once you should obtain an equation with a square root. You can try squaring both sides of the equation and then rearrange things to obtain a two-variable quadratic as usual, but you'll have to justify why the squaring is legal. You should end up with

$$7x^2-2xy+7y^2-46x+2y+71=0$$

-

As far as I know, $e=c/a=1/2$, and the distance from the focus to directrix is $a^2/c-c$. So it is easy to calculate a and c. And you will find the solution.

-