Linear transformation that preserves the determinant It seems "common knowledge" that the following holds:
Let $T$ be a linear transformation on nxn matrices with complex coefficients that preserves the determinant. Then there exists matrices U and V whose product has determinant 1 such that one of the following holds:
a) For any matrix $A$ we have $T(A)=UAV$
b) For any matrix $A$ we have $T(A)=UA^TV$ where $A^T$ is the transpose of $A$
It seems quite reasonable, but as far as "common knowledge" goes, I have no clue right now on how to prove such a thing?
 A: Eric Wofsey's answer can be modified a bit to drop the assumption that we're dealing with the field $K=\mathbb{C}$. Let $K$ be an arbitrary field with $|K|>n$ (where $n \in \mathbb{N}$ is our matrix dimension) and suppose $T(I)=CD$ for some matrices $C$ and $D$. The claim is that there exists some invertible matrix $B$ such that $T: A \mapsto CB^{-1}ABD$ or $T: A \mapsto CB^{-1}A^tBD$.
*We can begin by proving that $T$ is injective (and hence bijective) by the same argument as given by Wofsey. We change from $T$ to $T:=T'(.)=C^{-1}T(.)D^{-1}$ such that $T(I)=I$.
*To show that $T$ preserves the rank of matrices, recall that a rank $m$ matrix can be written as $A=Q\Lambda$ where $\Lambda$ is nonsingular and $Q$ has precisely $m$ nonzero linear independent columns (the other columns being zero). With this in mind, we can see that for any matrix $A$
\begin{equation}
rank(A)=\max \left\{ m \in \mathbb{N}\left.\right| D \in M_n:\det (\lambda D + A)= c_{n-m}\lambda^{n-m}+...+c_n \lambda^n \text{ with }c_{n-m} \neq 0 \right\}.
\end{equation}
(If I'm correct, the assumption that $|K|>n$ is important here, in the sense that for a polynomial $P$ of degree $\leq n$ we have $P(\lambda)=0$ for all $\lambda \in K$ only if $P=0$. Hence polynomials $P$ are uniquely fixed by their evaluations $P(\lambda)$)
But from the bijectivity of $T$ it follows that
\begin{equation}
rank(A)=\max \left\{ m \in \mathbb{N}\left.\right| D \in M_n:\det (\lambda D + A)=\det (T(\lambda D + A))=\det (\lambda T(D) + T(A))= c_{n-m}\lambda^{n-m}+...+c_n \lambda^n \text{ with }c_{n-m} \neq 0 \right\}=
\max \left\{ m \in \mathbb{N}\left.\right| D \in M_n:\det (\lambda D +T(A))= c_{n-m}\lambda^{n-m}+...+c_n \lambda^n \text{ with }c_{n-m} \neq 0 \right\}=rank(T(A))
\end{equation}
*The last modification to make is to revise the proof that $T$ maps projectors on projectors of equal rank. It is sufficient to prove that $A$ is a projector of rank $m$ iff $A$ has rank $m$ and $I-A$ has rank $n-m$. 
Proving the rightward implication is easy. For the leftward implication:
for any matrix $A$, we have the inclusion $\ker (A) \subset Ran (I-A)$ (easy exercise), which implies $\dim(\ker (A)) \leq \dim(Ran (I-A))$ where equality is attained iff $\ker (A) = Ran (I-A)$. By the dimension theorem, we then have that $n=\dim(Ran(A))+\dim(\ker(A))\leq \dim(Ran(A)) + \dim(Ran(I-A))$ with equality iff $\ker (A) = Ran (I-A)$. We conclude that
\begin{equation}
Rank(A)+Rank(I-A)=\dim(Ran(A))+\dim(Ran(I-A))=n \Rightarrow \ker (A) = Ran (I-A) \Rightarrow A(I-A)=0 \Rightarrow A\text{ is a projector}
\end{equation}
A: Here is a more geometric proof. Put $V=\mathbb{C}^n$. Consider the embedding $i:\mathbb{P}(V)\times \mathbb{P}(V^*)\hookrightarrow \mathbb{P}(\mathrm{End}(V))$ which associates to $(x,x^*)$ the endomorphism $z\mapsto \langle x^*,z\rangle x\ $; its image is 
the locus of rank 1 endomorphisms. Since $T$ preserves the rank, it induces an automorphism of $\mathbb{P}(V)\times \mathbb{P}(V^*)$. Now $i$ is the embedding defined by the global sections of  the line bundle $\mathcal{O}(1)\boxtimes \mathcal{O}(1)$; any automorphism of $\mathbb{P}(V)\times \mathbb{P}(V^*)$ preserves this line bundle, hence is induced by a unique automorphism of $\mathbb{P}(\mathrm{End}(V))$. These automorphisms are of the form $(x,x^*)\mapsto (u(x),{}^{t}\!v(x^*))$, with $u,v\in \mathrm{Aut}(V)$, or $(x,x^*)\mapsto ({}^{t}\!v(x^*),u(x))$, where $u$ (resp. $v$) is an isomorphism of $V$ onto $V^*$ (resp. $V^*$ onto $V$). It follows that $T(f)=ufv\ $ or $\ u{}^{t}\!fv$. 
A: First, some easy observations: $T$ must be injective since for any $A$, there is some $B$ such that $B$ and $A+B$ have different determinants (easy exercise).  By multiplying $T$ by $T(1)^{-1}$, it may be assumed that $T(1)=1$.
Now note that $T$ preserves the rank of matrices.  Indeed, $T$ must preserve the rank $n$ matrices, and then the rank $n-1$ matrices are just the nonsingular locus in the variety of matrices with determinant $0$.  This implies $T$ preserves rank $n-1$ matrices.  Rank $n-2$ matrices are then the nonsingular locus in rank $<n-1$ matrices so they are preserved, and so on.
Now rank $k$ projections are exactly those rank $k$ matrices which when subtracted from the identity give you something of rank $n-k$; this is easy to see from Jordan normal form.  Thus $T$ sends rank $1$ projections to rank $1$ projections.  Two projections have disjoint ranges and commute iff their sum is also a projection.  In particular, for $P_i$ the projections onto a basis $e_i$, $T$ sends $P_i$ to projections $Q_i$ onto some other basis $f_i$.  Now let $U$ be the change of basis matrix from the $e_i$ to the $f_i$.  Conjugating $T$ by $U$ shows that we may assume $T$ fixes each $P_i$.  That is, picking the standard basis, $T$ fixes all diagonal matrices.
Now matrices whose only nonzero entries are either all in the first row or all in the first column are characterized by the fact that they are rank $1$ and they remain rank $1$ if their first diagonal entry changes.  Similar statements hold for other rows and columns.  It follows that $T(e_{ij})$ is a multiple of either $e_{ij}$ or $e_{ji}$ for all $j$ and $i$, where $e_{ij}$ is the matrix with $ij$ entry $1$ and all others $0$.  By considering the ranks of matrices with only two nonzero entries, it is now easy to see that we must either always have $T(e_{ij})$ a multiple of $e_{ij}$ or always have $T(e_{ij})$ a multiple of $e_{ji}$.  Composing $T$ with the transpose map we may assume we are in the first case.
Now let $a_{ij}$ be the scalars such that $T(e_{ij})=a_{ij}e_{ij}$.  We know that $a_{ii}=1$, and by considering permutation matrices, it is easy to see that we must have $a_{ij}a_{jk}=a_{ik}$.  It follows that $T$ coincides with conjugation by the diagonal matrix with diagonal entries $a_{1i}$, and in particular $T$ has the form $T(A)=UAV$.
A: The conclusion you indicate is obtained as the main result in the following paper, but with an apparently stronger hypothesis: (EDIT: Not stronger at all, actually - just realized you're assuming the map is linear.)
Determinant preserving maps on matrix algebras
Gregor Dolinar and Peter Semrl
Linear Algebra and its Applications
Volume 348, Issues 1-3, 15 June 2002, Pages 189-192
Let $M_n$ be the algebra of all $n\times n$ complex matrices. If $\phi:M_n→M_n$ is a surjective mapping satisfying $\det(A+\lambda B)=\det(\phi(A)+\lambda\phi(B))$ then either $\phi$ is of the form $\phi(A)=MAN$ or $\phi$ is of the form $\phi(A)=MA^TN$ where $M,N$ are nonsingular matrices with $\det(MN)=1$.
A: It seems (at least for me) that the condition $|K|>n$ -obtained by Thibaut Demaerel- is useful only to show his characterization of the rank. We show that this result is valid for any field.
$\textbf{Proposition.}$ Let $K$ be any field, $A\in M_n(K)$ and let $f:D\in M_n(K)\mapsto degree(\det(D+sA),s)$.
Then $\max_D f(D)=rank(A)$.
$\textbf{Proof.}$ We may assume that $A=diag(N,U)$ where $N\in M_p(K)$ is nilpotent and in Jordan form and $U\in GL_{n-p}(K)$. 
i) $f(D)\leq rank(A)$. Let $u=rank(N)$; note that $rank(A)=n-p+u$.
Consider one of the $n!$ elements of $f(D)$; with the $n-p$ last columns, we obtain at most $n-p$ times the factor $s$; with the $p$ first columns we obtain at most $u$ times $s$ (it's exactly the number of $s$ amongst the entries of $N$).
ii) There is $D$ s.t. $f(D)=rank(A)$. We choose $D$ in the form $D=diag(P,0)$. Then $f(D)=\det(P+sN)\det(sU)$. It remains to show that there is $P=[p_{i,j}]$ s.t. $degree(P+sN)=u$.
Let $N=diag(J_{i_1},\cdots,J_{i_q})$ where $J_k$ is the nilpotent Jordan block of dimension $k$. Then it suffices to choose the $p_{i,j}$ equal to $1$ for the entries which are located at the bottom left of each block of Jordan and, otherwise, $0$.
Example: for $p=2+3$, $P+sN=diag(\begin{pmatrix}0&s\\1&0\end{pmatrix},\begin{pmatrix}0&s&0\\0&0&s\\1&0&0\end{pmatrix})$, 
