Hint for the Charpoly exercise

Hint for the Charpoly exercise

First of all, what is this exercise about? The idea is that you find yourself writing a document which contains lots of characteristic polynomials of 2 by 2 matrices, such as
ê
ê
ê
2-l
-1
3
1-l
ê
ê
ê
,       ê
ê
ê
4-l
0
2
-3-l
ê
ê
ê
,      and       ê
ê
ê
10-x
3
-4
2-x
ê
ê
ê
.
These take quite a lot of time to format in LATEX, so you'd like just to write 
\Charpoly{2}{-1}{3}{1}{\lambda} 
\Charpoly{4}{0}{2}{-3}{\lambda}, and  
\Charpoly{10}{3}{-4}{2}{x}
to produce them quickly.

If you find this exercise difficult, follow these steps:

  1. Write the LATEX code necessary to produce
    ê
    ê
    ê
    2-l
    -1
    3
    1-l
    ê
    ê
    ê

    .


  2. Turn this into a command, i.e. 
    \newcommand{\Charpoly}{your LATEX code}
  3. Now replace this command with 
    \newcommand{\Charpoly}[5]{your LATEX code}
    and, in the LATEX code, replace the particular numbers and the l for this example with appropriate #1, #2, etc.