swing
swing

Reputation: 159

Latex Equation and bmatrix

I'm trying to use official equation, and it's giving me some trouble. I have this equation of a simple matrix operation, and LaTeX isn't liking it. What's wrong with this statement?

\begin{equation}
$M=\begin{bmatrix}
V_{1,1} & . & . & V_{1,n}\\ 
. & . &  & \\   
. &  &.  & \\ 
 V_{m,1}&  &  & V_{m,n}
\end{bmatrix}$
\end{equation}

The error is: ! Display math should end with $$. M l.186 $M =\begin{bmatrix} ? )

Upvotes: 2

Views: 13541

Answers (2)

MattAllegro
MattAllegro

Reputation: 7345

Removing the two $s, you have no more error.

Then, you may want to use the commands \cdots, \vdots, \ddots available from LaTeX (package amsmath is not even necessary for these three, while it is required for environment bmatrix):

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
M=\begin{bmatrix}
V_{1,1} & \cdots & V_{1,n}\\
\vdots & \ddots & \vdots\\
V_{m,1} & \cdots & V_{m,n}
\end{bmatrix}
\end{equation}

\end{document}

produces

screenshot of output

(numbered equation). Notice how this is a 3-x-3 matrix, not 4-x-4.

Upvotes: 2

Giacomo Petrillo
Giacomo Petrillo

Reputation: 367

Delete the two dollar signs:

\begin{equation}
M=\begin{bmatrix}
V_{1,1} & . & . & V_{1,n}\\ 
. & . &  & \\   
. &  &.  & \\ 
 V_{m,1}&  &  & V_{m,n}
\end{bmatrix}
\end{equation}

Upvotes: 2

Related Questions