Quiz 9

Question 1:

Consider the 2x2 symmetric matrix

$$ A = \left[ \begin{array}{cc} a & b; \ c & d \end{array} \right] $$

and the 2x1 vector

$$ x = \left[ \begin{array}{c} u; \ v \end{array} \right]. $$

(Here a semicolon indicates that the following entries belong to the next row of the matrix.) Show that the derivative of $x^T A x$ with respect to $x$ can be expressed as

$$ x^T A + A^T x. $$

(Hint: write out the derivatives of the scalar quantity $x^T A x$ with respect to the individual components $u$ and $v$, then think about how you might express these two scalar quantities in terms of matrix-vector operations.) How can the derivative be simplified in the special case where $A$ is symmetric ($A^T = A$)? Can you argue that this expression for the derivative works for any $n \times n$ matrix (not just 2x2)?

Question 2:

Suppose you are given a triangle in the plane as three vertices $p_1, p_2, p_3$. Write an algorithm for determining whether a given query point $x$ is in the triangle. (You can write this in pseudocode, or "real" code; however you like!)