GeneralHow do I make a matrix(4x4) with a square bracket

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
akira32
Posts: 45
Joined: Tue Nov 13, 2007 10:32 am

How do I make a matrix(4x4) with a square bracket

Post by akira32 »

How do I make a matrix(4x4) with a square bracket? Like the picture I attached.
Attachments
matrix(4x4)
matrix(4x4)
matrix.JPG (12.32 KiB) Viewed 46272 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How do I make a matrix(4x4) with a square bracket

Post by localghost »

The picture does not show a matrix with a square bracket (box bracket), but with a round bracket (parenthesis) [1]. So, you should make clear which version you want. Both versions can be realised with the amsmath package.

[1] Bracket - Wikipedia, the free encyclopedia


Best regards
Thorsten¹
User avatar
FrankZA
Posts: 14
Joined: Wed Oct 17, 2007 1:02 pm

How do I make a matrix(4x4) with a square bracket

Post by FrankZA »

Easy.

Code: Select all

$\left[\begin{array}{cccc}
w1 & w2 & w3 & w4	\\
x1 & x2 & x3 & x4	\\
y1 & y2 & y3 & y4	\\
z1 & z2 & z3 & z4
\end{array}\right]$
You can choose your bracket type by simply changing the symbol after the \left and \right commands.
TeXnicCenter 1RC, LEd 0.53, MikTeX 2.8, Windows XP (SP3)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How do I make a matrix(4x4) with a square bracket

Post by localghost »

FrankZA wrote:Easy. [...] You can choose your bracket type by simply changing the symbol after the \left and \right commands.
The amsmath package offers the much easier way with the bmatrix and the pmatrix environment.

Code: Select all

\[
  \begin{bmatrix}
    a_{11} & a_{12} & a_{13} & a_{14} \\
    a_{21} & a_{22} & a_{23} & a_{24} \\
    a_{31} & a_{32} & a_{33} & a_{34} \\
    a_{41} & a_{42} & a_{43} & a_{44}
  \end{bmatrix}
\]
Replace bmatrix with pmatrix where necessary.
User avatar
FrankZA
Posts: 14
Joined: Wed Oct 17, 2007 1:02 pm

How do I make a matrix(4x4) with a square bracket

Post by FrankZA »

Using the \left and \right commands allows you to choose different "boundaries". For example when creating a conditional equation:

Code: Select all

$\left|x\right| = \left\{\begin{array}{cl}
    x & \textrm{if}\ x \geq 0\\
    -x & \textrm{if}\ x < 0
\end{array}\right.$
But I suppose that is a completely different problem.
Last edited by FrankZA on Fri Jun 27, 2008 10:18 am, edited 1 time in total.
TeXnicCenter 1RC, LEd 0.53, MikTeX 2.8, Windows XP (SP3)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How do I make a matrix(4x4) with a square bracket

Post by localghost »

FrankZA wrote:Using the \left and \right commands allows you to choose different "boundaries". For example when creating a conditional equation: [...] But I suppose that is a completely different problem.
For this issue the (preferably to use) amsmath package offers the cases environment.

Code: Select all

\[
  y=
  \begin{cases}
    x & \text{if}\quad y \geq 0 \\
    -x & \text{if}\quad y < 0
  \end{cases}
\]
As you can see, the amsmath package has also a solution. And it's again easier then that from standard LaTeX.
User avatar
FrankZA
Posts: 14
Joined: Wed Oct 17, 2007 1:02 pm

Re: How do I make a matrix(4x4) with a square bracket

Post by FrankZA »

Cool, will have to look into it.
TeXnicCenter 1RC, LEd 0.53, MikTeX 2.8, Windows XP (SP3)
Post Reply