# Explicitly write down $g\in GL(n,\mathbb{C})$ so that $gAg^{-1}$ is upper triangular, where $A\in M_n(\mathbb{C})$

This is an elementary question which is do-able by hand but I am actually looking for suggestions or book references since I am sure that someone did this somewhere:

suppose $$A = \left( \begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \\ \end{array} \right) \in M_2(\mathbb{C}).$$

Find $g=(g_{ij})\in GL(2,\mathbb{C})$ so that $gAg^{-1}$ is upper triangular.

One method is to explicitly write down $gAg^{-1}$ and set the function in 2nd row, 1st column equal to zero (which is $-a_{12} g_{21}^2 + g_{22} (a_{11} g_{21} - a_{22} g_{21} + a_{21} g_{22}) = 0$) and attempt to find $g$ this way, while a second method is to find the eigenvalues of $A$ (the two eigenvalues may or may not be distinct) and find their eigenvectors.

Wiki recommends Linear Algebra Done Right by Sheldon Axler and I think Sheldon proves that any $A\in M_n(\mathbb{C})$ can be put into an upper triangular form using induction.

Either of the methods that I mentioned above seems to be quite messy if I want to explicitly write down such $g$ for any $A\in M_2(\mathbb{C})$, or even for any $A\in M_n(\mathbb{C})$.

Do you have any recommended approach or references because I would like to explicitly write down $g\in GL(n,\mathbb{C})$ so that $gAg^{-1}$ is upper triangular, where $A\in M_n(\mathbb{C})$.

-
For just the $2$-by-$2$ case, note that $B\in M_2$ is upper triangular if and only if $e_1$ is an eigenvector of $B$. So if you find a single eigenvector $v$ for $A$, and let $g^{-1}$ be any invertible $2$-by-$2$ matrix whose first column is $v$, then $gAg^{-1}$ is upper triangular. –  Jonas Meyer Jun 30 '12 at 3:06
There is no reason for the resulting $g$ not to be messy... For example, one of the columns (or rows, I don't know) of $g$ is an eigenvector of $A$, and writing an eigenvector in terms of the entries of a generic matrix is a rather complicated business! –  Mariano Suárez-Alvarez Jun 30 '12 at 3:07
Thanks Jonas and Mariano! I'll just bite my tongue and crank through for the case $n>2$... I'm just curious how bad (or nice) this $g$ can get. –  math-visitor Jun 30 '12 at 3:12
(A little reflection shows that if you could find a $g$ whose entries are, say, rational functions on the entries of a generic $n$-by-$n$ matrix $A$, then you could then find formulas for the roots of polynomials of degree $n$ which are rational functions on the coefficients of the polynomial, and so on. We know such a feat is simply not possible) –  Mariano Suárez-Alvarez Jun 30 '12 at 3:13
An algorithm for finding $g$, with the added condition of taking $g$ to be unitary, is given in Hogben's Handbook of linear algebra.