<s>[INST] Exercise 13, Section 5.2 of Hoffman’s Linear Algebra 
Let $\Bbb{R}$ be the field of real numbers, and let $D$ be a function on $2 \times 2$ matrices over $\Bbb{R}$, with values in $\Bbb{R}$, such that $D(AB) = D(A)D(B)$ for all $A, B$. Suppose
also that $$D \left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)\neq D\left(\begin{bmatrix}1&0\\ 0&1\\ \end{bmatrix}\right)$$ Prove the following.
(a) $D(0)=0$;
(b) $D(A)=0$ if $A^2 = 0$;
(c) $D(B) = -D(A)$ if $B$ is obtained by interchanging the rows (or columns) of $A$;
(d) $D(A) = 0$ if one row (or one column) of $A$ is $0$;
(e) $D(A) = 0$ whenever $A$ is singular.

My attempt: (a) Since $D(AB)=D(A)D(B)$, $\forall A,B\in M_2(\Bbb{R})$ and $D \left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)\neq D\left(\begin{bmatrix}1&0\\ 0&1\\ \end{bmatrix}\right)$, we have $D(I_2)=1$, by exercise 12 section 5.2. By hypothesis, $D(0)=D(0)\cdot D(0)$. By elementary  properties of field, $D(0)\cdot (1-D(0))=0$. Which implies $D(0)=0$ or $D(0)=1$. If $D(0)=1$, then $$D(0) =D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)\cdot D(0)=1= D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)= D\left(\begin{bmatrix}1&0\\ 0&1\\ \end{bmatrix}\right).$$ Thus we reach contradiction. Hence $D(0)=0$.
(b) Suppose $A^2=0$. Then $D(A^2)$ $=D(A)\cdot D(A)$ $=D(0)$ $=0$. It’s easy to check, $(D(A))^2=0$$\iff$$D(A)=0$.
(c) Let $A= \begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}$ and $B= \begin{bmatrix}c&d\\ a&b\\ \end{bmatrix}$. Since $\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\cdot \begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}$ $=\begin{bmatrix}1&0\\ 0&1\\ \end{bmatrix}$ $=I_2$, we have $D(I_2)$ $=\left[D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix} \right) \right]^2=1$. Which implies $D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix} \right)$ $=\pm1$. Since $D(I_2)=1$ and $D \left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)\neq D(I_2)$, we have $D \left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)=-1$. Since $\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\cdot \begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}= \begin{bmatrix}c&d\\ a&b\\ \end{bmatrix} $, we have $$D\left(\begin{bmatrix}c&d\\ a&b\\ \end{bmatrix}\right)= D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)\cdot D\left(\begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}\right)=-D\left(\begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}\right).$$ Hence $D(B)=-D(A)$. Let $A= \begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}$ and $B= \begin{bmatrix}b&a\\ d&a\\ \end{bmatrix}$. Since $\begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}\cdot \begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}= \begin{bmatrix}b&a\\ d&c\\ \end{bmatrix} $, we have $$D\left(\begin{bmatrix}b&a\\ d&c\\ \end{bmatrix}\right)= D\left(\begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}\right)\cdot D\left(\begin{bmatrix}0&1\\ 1&0\\ \end{bmatrix}\right)=-D\left(\begin{bmatrix}a&b\\ c&d\\ \end{bmatrix}\right).$$ hence $D(B)=-D(A)$. Is my proof correct?
I tried very hard to do exercise (d) and (e), but can’t prove it. Observating pattern of proofs of (a), (b) and (c), I think we have to multiply some “clever” matrix with given matrix in such a way that $D$ of result matrix is familiar. In (d), we have to find matrix $\begin{bmatrix}p&q\\ r&s\\ \end{bmatrix}$ such that $\begin{bmatrix}a&b\\ 0&0\\ \end{bmatrix} \cdot \begin{bmatrix}p&q\\ r&s\\ \end{bmatrix}$ $= \begin{bmatrix}0&0\\ 0&0\\ \end{bmatrix}$, I guess. If we take $\begin{bmatrix}b&b\\ -a&-a\\ \end{bmatrix}$, then that works but what is value of $D\left(\begin{bmatrix}b&b\\ -a&-a\\ \end{bmatrix}\right)$.
 [/INST] Too long for a comment:
For (d): Let $E_{ij}$ be the matrix of zeros except with one in the $ij$ position. Let $S=E_{12}+E_{21}$ be the 'swap' matrix.
Show that $D(E_{11})$ is either zero or one.
Show that $D(SE_{11}) = D(E_{22}S)$ and since $E_{11} E_{22} = 0$ conclude that $D(E_{11})=0$.
If the top row of $A$ is zero then $E_{11}A = A$. Similar considerations work for the other situations.
For (e): If $A$ is singular then it can be reduced to a row echelon form (may need to swap rows) in which the lower row is zero.
</s>