# Math Help - Inserting matrices into equations

1. ## Inserting matrices into equations

I've been trying to create vector equations, ie something like

[matrix1] = [matrix2] [matrix3]

and am completely stumped. (matrix1 and 3 are 1 x 3 and matrix2 is 3 x 3)

I've creating the matrices using bmatrix, but no matter what I do they can't play nice. I've tried surrounding them with $$...$$, $$..$$, and $$$...$$$ and everytime I can get two matrices on the same line before Latex generates an error. I add each bit piece by piece but by the third matrix Latex complains about a missing $needing to be inserted, and when I take out the offending bit it still won't compile and the whole equation needs to be deleted. It would be great if I can get them with an equation number too. What should I do to achieve this? Here are my three matrices: Code: \begin{bmatrix} Y \\ I \\ Q \end{bmatrix} Code: \begin{bmatrix} 0.299 & 0.587 & 0.114 \\ 0.596 & -0.274 & -0.322 \\ 0.211 & -0.523 & 0.312 \end{bmatrix} Code: \begin{bmatrix} R \\ G \\ B \end{bmatrix} 2. Do you mean like this? Code: $$\begin{bmatrix} Y \\ I \\ Q \end{bmatrix} = \begin{bmatrix} 0.299 & 0.587 & 0.114 \\ 0.596 & -0.274 & -0.322 \\ 0.211 & -0.523 & 0.312 \end{bmatrix} \begin{bmatrix} R \\ G \\ B \end{bmatrix} \label{eq:1}$$ The trick seems to be to not include any$ or  or $or$ at all, they just lead to errors.

3. ## thanks

Yes, that seems to work. I had something like that code in mind, but for some reason I couldn't get it to work. Must have been missed some character I needed. I always struggle to get the syntax right with Latex's math.

4. Hello, bexica!

I didn't have any trouble . . .

I've been trying to create a vector equation, like: . $\text{[matrix\,1]} \:=\: \text{[matrix\,2]} \times \text{[matrix\,3]}$

$\text{[matrix\,1] and [matrix\:3] are }1\!\times\!3$ . . . . no
. . $\text{and [matrix\,2] is }3\!\times\!3$
You have: . $[1\times 3] \;=\;[3\times{\color{red}3}]\cdot[{\color{red}1}\times 3]$ . which cannot be multipled.

Here are my three matrices:

Code:
\begin{bmatrix}
Y \\ I \\ Q
\end{bmatrix}
$\text{This is }3\!\times\!1$

Code:
\begin{bmatrix}
0.299 & 0.587 & 0.114 \\
0.596 & -0.274 &  -0.322 \\
0.211 & -0.523 & 0.312
\end{bmatrix}
$\text{This is }3\!\times\!3$

Code:
\begin{bmatrix}
R \\ G \\ B
\end{bmatrix}
$\text{This is }3\!\times\!1$

And you want to output:

$\begin{bmatrix}Y \\ I \\ Q \end{bmatrix}\;=\;\begin{bmatrix}0.299 & 0.587 & 0.144 \\ 0.596 & \text{-}0.274 & \text{-}0.322 \\ 0.211 & \text{-}0.523 & 0.312\end{bmatrix} \cdot \begin{bmatrix}R \\ O \\ B \end{bmatrix}$

$_{3\times1}$ . . . . . . . . . $_{3\times3}$. . . . . . . . $_{3\times 1}$

Code:
\begin{bmatrix}
Y \\ I \\ Q
\end{bmatrix}

\;=\;

\begin{bmatrix}
0.299 & 0.587 & 0.144 \\
0.596 & \text{-}0.274 & \text{-}0.322 \\
0.211 & \text{-}0.523 & 0.312
\end{bmatrix}

\cdot

\begin{bmatrix}
R \\ O \\ B
\end{bmatrix}