0

enter image description here

This is my work. I did exactly what my tutorial said, but the latex simply doesn't work....What have I done wrong? It's extremely frustrating...

\documentclass{article}
\begin{document}
\begin{matrix}
    1&0\\
    0&1
\end{matrix}
\end{document}
1
  • 2
    Welcome! Please provide some compilable code, i.e. an MWE, not just a screenshot.
    – user121799
    Jan 25, 2018 at 17:09

1 Answer 1

3

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Matrices require appropriate packages, e.g.\ \texttt{amsmath}, and math
environments.
\[
\begin{matrix}
1 & 0\\
0 & 1
\end{matrix}\quad\text{vs.}\quad
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}
\]
If you don't like to load \texttt{amsmath}, you can get matrices with arrays.
\[
\begin{array}{cc}
1 & 0\\
0 & 1
\end{array}\quad\mbox{vs.}\quad
\left(\begin{array}{cc}
1 & 0\\
0 & 1
\end{array}\right)
\]
As you can see, this requires you to specify the columns.

If you want to number them, use some numbered math environment like
\texttt{equation} or \texttt{align}.
\begin{equation}
 \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}\cdot \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}\;,
\end{equation}
\begin{align}
 \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}\cdot \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}&~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix} \\
&~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}^{-1}\;.
\end{align}
Please consult the \texttt{amsmath} docu for more information.
\end{document}
4
  • And it needs to be in a math environment: so it's either in $ or between \[ and \].
    – Teepeemm
    Jan 25, 2018 at 17:16
  • @Teepeemm Well, I wrote that it needs to be in math environments.
    – user121799
    Jan 25, 2018 at 17:21
  • Thank you for your answers. Could you also show me how to number them like equations?
    – Keith
    Jan 25, 2018 at 17:24
  • @marmot You did. OP had previously commented (and subsequently deleted) something to the effect of "I just need the appropriate package."
    – Teepeemm
    Jan 25, 2018 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .