Derivative of the determinant function on $2\times2$ matrix I was asked to show the determinant function on $2\times2$ matrix, regarded as
$f:\mathbf{R^4}\rightarrow\mathbf{R}, f(x_1,x_2,x_3,x_4)=x_1x_4-x_2x_3$, is differentiable and to find its derivative. Here is my work:
In short, the function $f$ is defined as below
\begin{equation*}
f:\mathbf{R^4}\rightarrow\mathbf{R}, f(x_1,x_2,x_3,x_4)=\det
\begin{bmatrix}
x_1&x_2\\
x_3&x_4
\end{bmatrix}
=x_1x_4-x_2x_3
\end{equation*}
First we need to check its property, define
\begin{equation*}
x_{\max}=\max\{x_1,x_2,x_3,x_4\}
\end{equation*}
\begin{equation*}
x_{\min}=\min\{x_1,x_2,x_3,x_4\}
\end{equation*}
Then we notice
\begin{align*}
x_{\min}^2\leq x_1x_4\leq x_{\max}^2\\
-x_{\max}^2\leq-x_2x_3\leq -x_{\min}^2
\end{align*}
\begin{equation*}
\Downarrow 
\end{equation*}
\begin{equation*}
x_{\min}^2-x_{\max}^2\leq x_1x_4-x_2x_3\leq x_{\max}^2-x_{\min}^2
\end{equation*}
\begin{equation*}
\Downarrow 
\end{equation*}
\begin{equation*}
\lvert x_1x_4-x_2x_3\rvert\leq x_{\max}^2-x_{\min}^2<x_1^2+x_2^2+x_3^2+x_4^2
\end{equation*}
The last inequality actually implies, for any $x\in\mathbf{R^4}$,
\begin{equation}
\lvert f(x)\rvert<\lvert x\rvert^2
\end{equation}
Now we turn back to the problem we are facing. We need to find $Df(a)$ such that
\begin{equation*}
\lim_{h\to0}\frac{\lvert f(a+h)-f(a)-Df(a)\cdot h\rvert}{\lvert h\rvert}=0
\end{equation*}
Notice if we define $Df(a)$ and $h$ as below, we will have
\begin{equation*}
Df(a)=(a_4,-a_3,-a_2,a_1)
\end{equation*}
\begin{equation*}
h=(h_1,h_2,h_3,h_4)
\end{equation*}
\begin{equation*}
\Downarrow 
\end{equation*}
\begin{equation*}
Df(a)h=a_4h_1-a_3h_2-a_2h_3+a_1h_4
\end{equation*}
Now let us compute this limit, there is
\begin{equation*}
f(a+h)=f(a_1+h_1,a_2+h_2,a_3+h_3,a_4+h_4)=(a_1+h_1)(a_4+h_4)-(a_2+h_2)(a_3+h_3)
\end{equation*}
\begin{equation*}
=a_1a_4+a_1h_4+a_4h_1+h_1h_4-a_2a_3-a_2h_3-a_3h_2-h_2h_3
\end{equation*}
\begin{equation*}
f(a)=f(a_1,a_2,a_3,a_4)=a_1a_4-a_2a_3
\end{equation*}
\begin{equation*}
\Downarrow 
\end{equation*}
\begin{equation*}
f(a+h)-f(a)-Df(a)h=h_1h_4-h_2h_3
\end{equation*}
So the limit becomes
\begin{equation*}
\lim_{h\to0}\frac{\lvert f(a+h)-f(a)-Df(a)\cdot h\rvert}{\lvert h\rvert}=\lim_{(h_1,h_2,h_3,h_4)\rightarrow0}\frac{\lvert h_1h_4-h_2h_3\rvert}{\sqrt{h_1^2+h_2^2+h_3^2+h_4^2}}=\lim_{h\to0}\frac{\lvert f(h)\rvert}{\lvert h\rvert}
\end{equation*}
By (1), there is
\begin{equation*}
0\leq\frac{\lvert f(h)\rvert}{\lvert h\rvert}<\lvert h\rvert
\end{equation*}
\begin{equation*}
\Downarrow 
\end{equation*}
\begin{equation*}
\lim_{h\to 0}\frac{\lvert f(h)\rvert}{\lvert h\rvert}=0
\end{equation*}
which means, with $Df(a)$ defined as above, there is
\begin{equation*}
\lim_{h\to0}\frac{\lvert f(a+h)-f(a)-Df(a)h\rvert}{\lvert h\rvert}=0
\end{equation*}
Thus, $f$ is differentiable and
\begin{equation*}
Df(a)=
\begin{pmatrix}
a_4&-a_3&-a_2&a_1
\end{pmatrix}
\end{equation*}
Q.E.D
Any suggestion for me to improve?
 A: $
\def\L{\left}\def\R{\right}
\def\LR#1{\L(#1\R)}
\def\BR#1{\Big(#1\Big)}
\def\vec#1{\operatorname{vec}\LR{#1}}
\def\trace#1{\operatorname{Tr}\LR{#1}}
\def\qiq{\quad\implies\quad}
\def\m#1{\left[\begin{array}{c}#1\end{array}\right]}
$
For typing convenience, use a colon to denote the matrix inner product, i.e.
$$\eqalign{
A:B &= \sum_{i=1}^m\sum_{j=1}^n A_{ij}B_{ij} \;=\; \trace{A^TB} \\
A:A &= \big\|A\big\|_F^2 \\
I:A &= \trace{A} \\
}$$
Use the above notation to solve the characteristic polynomial for the determinant
$$\eqalign{
0 &= X^2-X\;\trace{X} + I\;\det(X) \\
  &= I:\LR{X^2-X\;\LR{I:X} + I\;\det(X)} \\
  &= \BR{X^T:X}-\BR{I:X}^2+\BR{2\;\det(X)} \\
 \det(X)
 &= \LR{\frac{\LR{I:X}^2-X^T:X}{2}} = \LR{\frac{\trace{X}^2-\trace{X^2}}{2}} \\
}$$
This is nothing but a polynomial in the elements of $X$ and is therefore differentiable.
Now calculate its differential and derivative
$$\eqalign{
 d\det(X) &= \tfrac 12\BR{2\LR{I:X}\LR{I:dX}-\LR{2X^T:dX}} \\
 &= \BR{\LR{I:X}\,I-X^T}:dX \\
D\,{\det(X)} &= {\LR{I:X}\;I-X^T} \\
 &= {\trace{X}\;I-X^T} \\
}$$
An explicit matrix calculation looks like
$$\eqalign{
X &= \m{x_1&x_2 \\ x_3&x_4} \qiq X^T = \m{x_1&x_3 \\ x_2&x_4},\quad
  \trace{X} = {x_1+x_4} \\
D\,{\det(X)} &= \LR{x_1+x_4}\m{1&0\\ 0&1} - \m{x_1&x_3 \\ x_2&x_4}
 \;=\; \m{x_4&-x_3\\-x_2&x_1} \\\\
}$$
