Math & ScienceWrite Matric Multiplication out in full

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
bazman
Posts: 78
Joined: Mon Jan 26, 2009 3:24 am

Write Matric Multiplication out in full

Post by bazman »

Hi there,

I want to multiply two equation together on the same line.

I tried, but clearly that is incorrect can you advise?

Code: Select all

\documentclass{article} % Your input file must contain these two lines
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{grffile}
\usepackage{graphicx}
\usepackage[%
  font=small,
  labelfont=bf,
  figurewithin=section,
  tablewithin=section,
  tableposition=top
]{caption}
\numberwithin{equation}{section}
\begin{document}

\[ \textbf{P} = \left[ \begin{array}{ccccccccccc}
1 & -2 & 1 & 0 &. &.&.&0&0&0&0  \\
\frac{1}{6} & \frac{2}{3} & \frac{1}{6} & 0 &. &.&.&0&0&0&0  \\
0 & \frac{1}{6} & \frac{2}{3} & \frac{1}{6} &. &.&.&0&0&0&0  \\
. & . & . & . &. &&&.&.&.&.  \\
. & . & . & . &&.&&.&.&.&.  \\
. &.&.&.& &&.&.&.&.&.  \\
0 & 0 & 0 & 0 &. &.&.&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}&0  \\
0 & 0 & 0 & 0 &. &.&.&0&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}  \\
0 & 0 & 0 & 0 &. &.&.&0&1&2&1  \\
\end{array} \right] \] = \[ \textbf{P} = \left[ \begin{array}{c}
1  \\
\frac{1}{6}\\
0 \\
. \\
. \\
. \\
0 \\
0 \\
0 \\
\end{array} \right] \]

\end{document}

Recommended reading 2024:

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

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

bazman
Posts: 78
Joined: Mon Jan 26, 2009 3:24 am

Write Matric Multiplication out in full

Post by bazman »

getting closer but I want the three matrices to lie on one line.

Code: Select all

\documentclass{article} % Your input file must contain these two lines
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{grffile}
\usepackage{graphicx}
\usepackage[%
  font=small,
  labelfont=bf,
  figurewithin=section,
  tablewithin=section,
  tableposition=top
]{caption}
\numberwithin{equation}{section}
\begin{document}

\left[ \begin{array}{ccccccccccc}
1 & -2 & 1 & 0 &. &.&.&0&0&0&0  \\
\frac{1}{6} & \frac{2}{3} & \frac{1}{6} & 0 &. &.&.&0&0&0&0  \\
0 & \frac{1}{6} & \frac{2}{3} & \frac{1}{6} &. &.&.&0&0&0&0  \\
. & . & . & . &. &&&.&.&.&.  \\
. & . & . & . &&.&&.&.&.&.  \\
. &.&.&.& &&.&.&.&.&.  \\
0 & 0 & 0 & 0 &. &.&.&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}&0  \\
0 & 0 & 0 & 0 &. &.&.&0&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}  \\
0 & 0 & 0 & 0 &. &.&.&0&1&2&1  \\
\end{array} \right] * \[  \left[ \begin{array}{c}
a_{-3} \\
a_{-2}\\
a_{-1} \\
. \\
. \\
. \\
a_{N-2} \\
a_{N-1} \\
a_{N} \\
\end{array} \right] \] = \[  \left[ \begin{array}{c}
0  \\
f_0\\
f_1 \\
. \\
. \\
. \\
f_{N-1} \\
f_{N} \\
0 \\
\end{array} \right] \]


\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Write Matric Multiplication out in full

Post by Stefan Kottwitz »

Hi,

use the pair \[ \] just once to create one equation, here's a correction:

Code: Select all

\[\left[ \begin{array}{ccccccccccc}
1 & -2 & 1 & 0 &. &.&.&0&0&0&0  \\
\frac{1}{6} & \frac{2}{3} & \frac{1}{6} & 0 &. &.&.&0&0&0&0  \\
0 & \frac{1}{6} & \frac{2}{3} & \frac{1}{6} &. &.&.&0&0&0&0  \\
. & . & . & . &. &&&.&.&.&.  \\
. & . & . & . &&.&&.&.&.&.  \\
. &.&.&.& &&.&.&.&.&.  \\
0 & 0 & 0 & 0 &. &.&.&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}&0  \\
0 & 0 & 0 & 0 &. &.&.&0&\frac{1}{6} & \frac{2}{3} & \frac{1}{6}  \\
0 & 0 & 0 & 0 &. &.&.&0&1&2&1  \\
\end{array} \right] * \left[ \begin{array}{c}
a_{-3} \\
a_{-2}\\
a_{-1} \\
. \\
. \\
. \\
a_{N-2} \\
a_{N-1} \\
a_{N} \\
\end{array} \right]  =   \left[ \begin{array}{c}
0  \\
f_0\\
f_1 \\
. \\
. \\
. \\
f_{N-1} \\
f_{N} \\
0 \\
\end{array} \right] \]
You could improve the readability of your output, further I recommend to use matrix environments of amsmath, like \begin{bmatrix} ... \end{bmatrix}.

Stefan
LaTeX.org admin
Post Reply