Ellipse in the triangle Find the equation of an ellipse if its center is S(2,1) and the edges of a triangle PQR are tangent lines to this ellipse. P(0,0), Q(5,0), R(0,4). 
My attempt: Let take a point on the line PQ. For example (m,0). Then we have an equation of a tangent line for this point: $(a_{11}m+a_1)x+(a_{12}m+a_2)y+(a_1m+a)=0$, where $a_{11}$ etc are coefficients of our ellipse: $a_{11}x^2+2a_{12}xy+a_{22}y^2+2a_1x+2a_2y+a=0$. Now if PQ: y=0, then $(a_{11}m+a_1)=0$, $a_{12}m+a_2=1$, $a_1m+a=0$.I've tried this method for other 2 lines PR and RQ and I got 11 equations (including equations of a center)! Is there a better solution to this problem?

The triangle vertices are $P_1 (0,0), Q_1 (5, 0), R_1 (0, 4) $
The equation of the ellipse in matrix-vector form is
$ (r - C)^T Q (r - C) = 1 $
where $C = (2, 1) $ is the center , and $Q$ is a $2 \times 2$ symmetric matrix.
Drawing the triangle, we realize that the required ellipse is tangent to the $x$ axis, the $y$ axis, and the line $y = 5 - \frac{5}{4} x $.
Starting with the $x$ axis, we know that the gradient will be pointing in the $-j$ direction.
Now the gradient $g = 2 Q (r - C) $.  If $r_1$ is the tangent point to the ellipse on the $x$ axis then we must have
$ Q(r_1 - C) = \alpha (-j) $
So that $(r_1 - C) = - \alpha Q^{-1} j $
Pluggin this into the ellipse equation gives us $\alpha = \dfrac{1}{\sqrt{ j^T Q^{-1} j }} $
Therefore, $ r_1 - C = - \dfrac{ Q^{-1} j }{\sqrt{ j^T Q^{-1} j } } $
Note that $r_1$ is a point on the $x$ axis, so its $y$ coordinate is zero, i.e. $j^T r_1 = 0 $.  Hence
$ j^T (r_1 - C) = - j^T C = - C_y = - \sqrt{ j^T Q^{-1} j } $
Hence, $C_y = 1 = \sqrt{ j^T Q^{-1} j } = Q_{22}^{-1} $
Similar to the above reasoning, we find that $C_x = \sqrt{i^T Q^{-1} i} = Q_{11}^{-1} $
Hence, so far, $Q^{-1} =\begin{bmatrix} 4 && Q_{12}^{-1} \\ Q_{12}^{-1} && 1 \end{bmatrix}  $
To find the last unknown, we use the the third condition, which is tangency with the line $y = 5 - \frac{5}{4} x $
The vector $QR = (-5, 4) $ so the unit normal vector to $QR$ is $n = \dfrac{1}{\sqrt{41}} (4, 5) $
Similar to the first tangency analysis with the $x$ axis, we have
$ r_3 - C = \gamma Q^{-1} n $
Plugging this into the ellipse equation results in $\gamma = \dfrac{1}{\sqrt{n^T Q^{-1} n }} $
Therefore, $ n^T (r_3 - C) = n^T (R_1 - C) = n^T (Q_1 - C) = \sqrt{ n^T Q^{-1} n } $
Now $ n^T (R_1 - C) = n^T ( (0,4) - (2, 1) ) = \dfrac{1}{\sqrt{41}} ((4, 5) \cdot (-2, 3) = \dfrac{7}{\sqrt{41}}$
And, $n^T Q^{-1} n = \dfrac{1}{41} ( 4 (4)^2 + 1 (5)^2 + 2 Q_{12}^{-1} (4)(5) )$
Hence $ 40 Q_{12}^{-1} = -40 $ From which $Q_{12}^{-1} = -1 $
Thus, $Q^{-1} = \begin{bmatrix} 4 && -1 \\ -1 && 1 \end{bmatrix} $
Inverting, we get $Q = \dfrac{1}{3} \begin{bmatrix} 1 && 1 \\ 1 && 4 \end{bmatrix} $
Plugging $Q$ in the ellipse equation and expanding gives
$  (x-2)^2 + 2 (x-2)(y-1) + 4 (y-1)^2 = 3 $
