How can matrices be written in Latex with or without vertical lines?

  • Context: LaTeX 
  • Thread starter Thread starter basty
  • Start date Start date
  • Tags Tags
    Latex Matrix
Click For Summary
SUMMARY

This discussion focuses on writing matrices in LaTeX, specifically using the pmatrix environment for standard matrices and the array environment for matrices with vertical lines. The pmatrix syntax is demonstrated with the example matrix containing integers, while the array environment is used for a matrix that includes a vertical line, showcasing the need for manual formatting. The provided LaTeX code snippets are essential for anyone looking to format matrices correctly in their documents.

PREREQUISITES
  • Familiarity with LaTeX syntax
  • Understanding of matrix notation
  • Knowledge of the pmatrix and array environments in LaTeX
  • Basic LaTeX document structure
NEXT STEPS
  • Explore advanced LaTeX environments for matrix formatting
  • Learn about the use of the \left and \right commands in LaTeX
  • Research additional LaTeX packages for enhanced matrix capabilities
  • Practice creating complex matrices with multiple vertical lines
USEFUL FOR

Students, researchers, and professionals in mathematics, engineering, or computer science who need to present matrices in LaTeX format.

basty
Messages
94
Reaction score
0
How do you write a matrix such as below image in Latex, in this forum?

Matrix.png
 
Physics news on Phys.org
Normally, the easiest way to write a matrix is to use the pmatrix environment:
Code:
\begin{pmatrix}
2 & 6 & 1 \\ 1 & 2 & -1 \\ 5 & 7 & -4
\end{pmatrix}
$$
\begin{pmatrix}
2 & 6 & 1 \\ 1 & 2 & -1 \\ 5 & 7 & -4
\end{pmatrix}
$$

If you need the vertical line, you have to do the matrix "by hand," and it requires a bit more work:
Code:
\left(
\begin{array}{rrr|r}
2 & 6 & 1 & 7 \\ 1 & 2 & -1 & -1 \\ 5 & 7 & -4 & 9
\end{array}
\right)
$$
\left(
\begin{array}{rrr|r}
2 & 6 & 1 & 7 \\ 1 & 2 & -1 & -1 \\ 5 & 7 & -4 & 9
\end{array}
\right)
$$
 
  • Like
Likes   Reactions: Greg Bernhardt

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K