# How to write a multiline matrix equation

So basically I want to write these two matrices equations but in only one referenced equation.

I have the following code:

\begin{equation*} \label{eq:matrices_estado}
\begin{bmatrix}
\Dot{x}_1\\
\Dot{x}_2\\
\Dot{x}_3
\end{bmatrix}
=
\begin{bmatrix}
0 & 2.083 & 0\\
0 & -1.708 & 100\\
-0.3183k & 0 & -100
\end{bmatrix}
\begin{bmatrix}
x_1\\
x_2\\
x_3
\end{bmatrix}
+
\begin{bmatrix}
0\\
0\\
3.1831k
\end{bmatrix}
\theta_i
\end{equation*}
\begin{align*}
\theta_o =
\begin{bmatrix}
0.1 & 0 & 0
\end{bmatrix}
\begin{bmatrix}
x_1\\
x_2\\
x_3
\end{bmatrix}
\end{align*}


And actually the outcome is the image I showed before, the only problem is that it doesn't appear numbered, and the reference in text appears wrong.

• Do you want the two equations to share a tag? Jun 10, 2023 at 2:03
• Welcome. // Please make it a habit, to post only code, which compiles after copy. By doing so you automatically avoid us being puzzled, which package(s) you may or may not have used ... Thank you Jun 10, 2023 at 8:40
• Thanks for the note @MS-SPO I'll take it into account for other posts. Jun 12, 2023 at 5:28
• @Stephen I want to have only one equation number, like they're just one equations, just written in two different lines Jun 12, 2023 at 5:30
• Both equation* and align* do not produce a numbered equation(s).
– Werner
Jun 12, 2023 at 17:25

Do you mean like the image below?

You can use \begin{gathered}...\end{gathered}, inside $$...$$ or \begin{align}...\end{align} like this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\begin{gathered} \begin{bmatrix} \Dot{x}_1\\ \Dot{x}_2\\ \Dot{x}_3 \end{bmatrix} = \begin{bmatrix} 0 & 2.083 & 0\\ 0 & -1.708 & 100\\ -0.3183k & 0 & -100 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3 \end{bmatrix} + \begin{bmatrix} 0\\ 0\\ 3.1831k \end{bmatrix} \theta_i\\ \theta_o = \begin{bmatrix} 0.1 & 0 & 0 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3 \end{bmatrix} \end{gathered} \label{eq:matrices_estado}$$

\end{document}