Tables in LaTeX

hi i made the following table

[itex]
\begin{center}
\begin{tabular}{l|l|l}
\hline
& \multicolumn{2}{c}{TYPE OF MATTER} \\
\cline{2-3}
& ``Dust'' & ``Radiation'' \\
SPATIAL GEOMETRY & $P=0$ & $P=\frac{1}{3} \rho$ \\
\hline \\
\multirow{2}{*}{3-sphere, $K=1$} & $a=\frac{1}{2}C \left( 1 - \cos{\eta} \right) $ & $a=\sqrt{C'} \left( 1- \left( 1 - \frac{\tau}{\sqrt{C'}} \right)^2 \right)^{\frac{1}{2}}$ \\
& $\tau=\frac{1}{2}C \left( \eta - \sin{\eta} \right)$ & \\
\hline
Flat, $k=0$ & $a= \left( \frac{9C}{4} \right)^{\frac{1}{3}} \tau^{\frac{2}{3}}$ & $a=\left( 4C' \right)^{\frac{1}{4}} \tau^{\frac{1}{2}}$ \\
\hline
\multirow{2}{*}{3-hyperboloid, $k=-1$} & $a=\frac{1}{2} C \left( \cosh{\eta} - 1 \right)$ & $a=\sqrt{C'} \left( \left( 1 + \frac{\tau}{\sqrt{C'}} \right)^2 -1 \right)^{\frac{1}{2}}$ \\
& $\tau=\frac{1}{2}C \left( \sinh{\eta} - \eta \right)$ & \\
\hline
\end{tabular}
\end{center}
[/itex]

with teh following code:

\begin{center}
\begin{tabular}{l|l|l}
\hline
& \multicolumn{2}{c}{TYPE OF MATTER} \\
\cline{2-3}
& ``Dust'' & ``Radiation'' \\
SPATIAL GEOMETRY & $P=0$ & $P=\frac{1}{3} \rho$ \\
\hline \\
\multirow{2}{*}{3-sphere, $K=1$} & $a=\frac{1}{2}C \left( 1 - \cos{\eta} \right) $ & $a=\sqrt{C'} \left( 1- \left( 1 - \frac{\tau}{\sqrt{C'}} \right)^2 \right)^{\frac{1}{2}}$ \\
& $\tau=\frac{1}{2}C \left( \eta - \sin{\eta} \right)$ & \\
\hline
Flat, $k=0$ & $a= \left( \frac{9C}{4} \right)^{\frac{1}{3}} \tau^{\frac{2}{3}}$ & $a=\left( 4C' \right)^{\frac{1}{4}} \tau^{\frac{1}{2}}$ \\
\hline
\multirow{2}{*}{3-hyperboloid, $k=-1$} & $a=\frac{1}{2} C \left( \cosh{\eta} - 1 \right)$ & $a=\sqrt{C'} \left( \left( 1 + \frac{\tau}{\sqrt{C'}} \right)^2 -1 \right)^{\frac{1}{2}}$ \\
& $\tau=\frac{1}{2}C \left( \sinh{\eta} - \eta \right)$ & \\
\hline
\end{tabular}
\end{center}

but i'd like any advice on how to make it look a bit more professional. for example, that line that's incomplete in the middle - how do i sort that?

thanks.
 

D H

Staff Emeritus
Science Advisor
Insights Author
15,259
679
Delete the '\\' after the \hline after the "SPATIAL GEOMETRY" line.
 
cheers. i also get a line sticking out the bottom between the spatial geometry and dust columns. any advice on how to deal with that?
 
If you want "Spatial Geoemtry" to be in the middle vertically you can put this
\multirow{3}{*}{SPATIAL GEOMETRY}
in the first row itself.
 
Although n.karthick already necroposted, I guess, I can just add something as well:

Never EVER use the standard LaTeX tabular environment with vertical lines. It's absolutely horrible.

Use the booktabs package, and arrange your table layout by justifying your cells' contents.
 
The left side of [itex]A^*[/itex] is [itex]A = \left[
\begin{smallmatrix}
9 &7\\
1 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex]. The idea is to reduce the left side of [itex]A^*[/itex] from [itex]A[/itex] to [itex]I[/itex] in order to produce the right side of [itex]A^*_t[/itex] from [itex]I[/itex] to [itex]A^{-1}[/itex].

Sorry. Just testing. Apparently your testing thread is no longer active.
 
The left side of [itex]A^*[/itex] is [itex]A = \left[
\begin{smallmatrix}
9 &7\\
1 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex]. The idea is to reduce the left side of [itex]A^*[/itex] from [itex]A[/itex] to [itex]I[/itex] in order to produce the right side of [itex]A^*_t[/itex] from [itex]I[/itex] to [itex]A^{-1}[/itex].

Now the left side of [itex]A^*_t[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*_t[/itex] is [itex]A^{-1} = \left[ \frac{1}{2}
\begin{smallmatrix}
1 &-7\\
-1 &9
\end{smallmatrix} \right][/itex]. In other words, as [itex]A[/itex] is reduced from [itex]A[/itex] to [itex]I[/itex], [itex]A^{-1}[/itex] is simultaneously produced from [itex]I[/itex] to [itex]A^{-1}[/itex].
 
The left side of [itex]A^*[/itex] is [itex]A = \left[
\begin{smallmatrix}
9 &7\\
1 &1
\end{smallmatrix} \right]
[/itex] and the right side of [itex]A^*[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex]. The idea is to reduce the left side of [itex]A^*[/itex] from [itex]A[/itex] to [itex]I[/itex] in order to produce the right side of [itex]A^*_t[/itex] from [itex]I[/itex] to [itex]A^{-1}[/itex].

Now the left side of [itex]A^*_t[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*_t[/itex] is [itex]A^{-1} = \frac{1}{2} \left[
\begin{smallmatrix}
1 &-7\\
-1 &9
\end{smallmatrix} \right][/itex]. In other words, as [itex]A[/itex] is reduced from [itex]A[/itex] to [itex]I[/itex], [itex]A^{-1}[/itex] is simultaneously produced from [itex]I[/itex] to [itex]A^{-1}[/itex].
 
Your problem states that [itex]325[/itex] people attended the theatre that day, grossing [itex]\$ 2675[/itex], at [itex]\$ 9[/itex] per ticket per adult and [itex]\$ 7[/itex] per ticket per child. This means that [itex]\$ 9[/itex] times the number of adults plus [itex]\$ 7[/itex] times the number of children produced [itex]\$ 2675[/itex], and that the total number of adults plus children was [itex]325[/itex]. This is your system of linear equations:

[tex]
\begin{align*}
9x_1 + 7x_2 &= 2675\\
\phantom{9}x_1 + \phantom{7}x_2 &= 325
\end{align*}
[/tex]

You mentioned that you needed to use matrices to solve the problem. Then you will need to convert your system of linear equations to matrix form, as follows:

[tex]
\begin{equation*}
\begin{bmatrix}
9 & 7\\
1 & 1
\end{bmatrix}
\begin{bmatrix}
x_1\\
x_2
\end{bmatrix}
=
\begin{bmatrix}
2675\\
325
\end{bmatrix}
\end{equation*}
[/tex]

This will produce a matrix equation of the form [itex]AX = B[/itex] for coefficient matrix [itex]A = \left[
\begin{smallmatrix}
9 & 7\\
1 & 1
\end{smallmatrix} \right][/itex], solution matrix [itex]X = \left[
\begin{smallmatrix}
x_1\\
x_2
\end{smallmatrix} \right][/itex], constant matrix [itex]B = \left[
\begin{smallmatrix}
2675\\
325
\end{smallmatrix} \right][/itex] and identity matrix [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex] such that:

[tex]
\begin{align*}
AX &= B\\
A^{-1}AX &= A^{-1}B\\
IX &= A^{-1}B\\
X &= A^{-1}B
\end{align*}
[/tex]

Given [itex]X[/itex] and [itex]B[/itex], you need to find [itex]A^{-1}[/itex], the inverse matrix of [itex]A[/itex], if it exists, to solve the equation. Using elementary row operations, [itex]r_i[/itex], on [itex]A^*[/itex], the augmented matrix of [itex]A[/itex], allows you to obtain [itex]A^{-1}[/itex]:

[tex]
\begin{align*}
A^* &= [A|I] \xrightarrow{r_1} \cdots \xrightarrow{r_n} [I|A^{-1}] = A^*_t\\
&=
\begin{bmatrix}
9 &7 &| &1 &0\\
1 &1 &| &0 &1
\end{bmatrix}
\xrightarrow{r_1} \cdots \xrightarrow{r_4}
\begin{bmatrix}
1 &0 &| &\frac{1}{2} &-\frac{7}{2}\\
0 &1 &| &-\frac{1}{2} &\frac{9}{2}
\end{bmatrix}
= A^*_t
\end{align*}
[/tex]
(Refer to the Appendix for a description of the elementary row operations which transform [itex]A^*[/itex] to [itex]A^*_t[/itex].)

So that:

[tex]
\begin{align*}
A^{-1} &= \phantom{\dfrac{1}{2}}
\begin{bmatrix}
\frac{1}{2} &-\frac{7}{2}\\
-\frac{1}{2} &\frac{9}{2}
\end{bmatrix}\\
&= \dfrac{1}{2}
\begin{bmatrix}
1 &-7\\
-1 &9
\end{bmatrix}
\end{align*}
[/tex]
Since [itex]X = A^{-1} B[/itex] for [itex]X = \left[
\begin{smallmatrix}
x_1\\
x_2
\end{smallmatrix} \right][/itex], [itex]A^{-1} = \frac{1}{2} \left[
\begin{smallmatrix}
1 &-7\\
-1 &9
\end{smallmatrix} \right][/itex] and [itex]B = \left[
\begin{smallmatrix}
2675\\
325
\end{smallmatrix} \right][/itex], then:

[tex]
\begin{align*}
\begin{bmatrix}
x_1\\
x_2
\end{bmatrix}
&= \dfrac{1}{2}
\begin{bmatrix}
1 &-7\\
-1 &9
\end{bmatrix}
\begin{bmatrix}
2675\\
325
\end{bmatrix}\\
&= \dfrac{1}{2}
\begin{bmatrix}
2675 - 7 \cdot 325\\
9 \cdot 325 - 2675
\end{bmatrix}\\
&= \dfrac{1}{2}
\begin{bmatrix}
2675-2275\\
2925-2675
\end{bmatrix}\\
&= \phantom{\frac{1}{2}}
\begin{bmatrix}
200\\
125
\end{bmatrix}
\end{align*}
[/tex]

Therefore, [itex]x_1=200[/itex] adults and [itex]x_2=125[/itex] children attended the theatre that day.
 
Last edited:
Appendix

The left side of [itex]A^*[/itex] is [itex]A = \left[
\begin{smallmatrix}
9 &7\\
1 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex]. The idea is to reduce the left side of [itex]A^*[/itex] from [itex]A[/itex] to [itex]I[/itex] in order to reproduce the right side of [itex]A^*_t[/itex] from [itex]I[/itex] to [itex]A^{-1}[/itex].

[tex]
\begin{align*}
A^* &= \; \,
\begin{bmatrix}
9 &7 &|&1 &0\\
1 &1 &|&0 &1
\end{bmatrix}\\
&\xrightarrow{r_1}
\begin{bmatrix}
1 &1 &| &0 &1\\
9 &7 &| &1 &0
\end{bmatrix}\\
&\xrightarrow{r_2}
\begin{bmatrix}
1 &1 &| &0 &1\\
0 &-2 &| &1 &-9
\end{bmatrix}\\
&\xrightarrow{r_3}
\begin{bmatrix}
1 &1 &| &0 &1\\
0 &1 &| &-\frac{1}{2} &\frac{9}{2}
\end{bmatrix}\\
&\xrightarrow{r_4}
\begin{bmatrix}
1 &0 &| &\frac{1}{2} &-\frac{7}{2}\\
0 &1 &| &-\frac{1}{2} &\frac{9}{2}
\end{bmatrix}\\
&\; \, = A^*_t
\end{align*}
[/tex]

Now the left side of [itex]A^*_t[/itex] is [itex]I = \left[
\begin{smallmatrix}
1 &0\\
0 &1
\end{smallmatrix} \right][/itex] and the right side of [itex]A^*_t[/itex] is [itex]A^{-1} = \left[
\begin{smallmatrix}
1/2 &-7/2\\
-1/2 &9/2
\end{smallmatrix} \right][/itex]. In other words, as [itex]A[/itex] is reduced from [itex]A[/itex] to [itex]I[/itex], [itex]A^{-1}[/itex] is simultaneously reproduced from [itex]I[/itex] to [itex]A^{-1}[/itex].
 

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top