TITLE: Check if a point is within an ellipse
QUESTION [67 upvotes]: I have an ellipse centered at $(h,k)$, with semi-major axis $r_x$, semi-minor axis $r_y$, both aligned with the Cartesian plane.
How do I determine if a point $(x,y)$ is within the area bounded by the ellipse?

REPLY [7 votes]: 1) Consider the point as a vector
$$
      p=\begin{bmatrix}
        x \\
        y \\
        \end{bmatrix}
$$
2) Consider the center of the ellipse as
$$
      c=\begin{bmatrix}
        h \\
        k \\
        \end{bmatrix}
$$
3) Subtract the center of the ellipse
$$
      p_{centered}= p - c
$$
4) Create a whitening matrix
$$
      W = \Lambda^{-1/2}E^T
$$
where
$$
    \Lambda = \begin{bmatrix}
        r_x & 0 \\
        0 & r_y \\
        \end{bmatrix}
$$
and
$$
    E = \begin{bmatrix}
        e_{major} & e_{minor}\\
        \end{bmatrix}
$$
where $e_{major}$ and $e_{major}$ are the unit vectors in the direction of the ellipse's major and minor axes.  Since you're example is for a non-rotated matrix with major axis along x-axis and minor axis along y-axis
$e_{major}=\begin{bmatrix}
        1\\
        0\\
        \end{bmatrix}$ and $e_{minor}=\begin{bmatrix}
        0\\
        1\\
        \end{bmatrix}$
5) Whiten the point
$$
      p_{white} = Wp_{centered}
$$
6) Check if the length of the vector is less than 1.
If it is, then the point is within the ellipse.
Note: this is inspired by my experience with Covariance matrices.
I'll try to update this answer with an intuitive relation b/w ellipses and covariance matrices.  For now you can take a peak at http://www.visiondummy.com/2014/04/draw-error-ellipse-representing-covariance-matrix/