Math & ScienceArray dimension problem

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
adnaniut
Posts: 11
Joined: Tue Aug 10, 2010 1:23 am

Array dimension problem

Post by adnaniut »

Hi,

For the following array,
\left[
\underbrace{\begin{array}{c c c c}
p_2^m & p_1 p_2^m & \cdots & p_1^{n-1} p_2^m
\end{array}
}_n
\right.\underbrace{\left. \begin{array}{c c c c}
p_1^n & p_2 p_1^n &\cdots & p_2^{m-1} p_1^n \end{array}\right]}_m \times \left[
\begin{array}{c}
\frac{\displaystyle \sum_{i=0}^{n-1} q_2^i - q_2^n }{q_2^n} \\
\frac{\displaystyle \sum_{i=0}^{n-2} q_2^i - q_2^n }{q_2^n} \\
\vdots \\
\frac{\displaystyle \sum_{i=0}^{n-(n+1)} q_2^i - q_2^n }{q_2^n} \\
\frac{1 - q_2^n }{q_2^n} \\
0 \\
\vdots \\
0\\
\frac{\displaystyle q_1 \sum_{i=0}^{n-1} q_2^i}{q_2^n}
\end{array}\right]

I want to impose a curly bracket outside the main bracket to show dimension size. I could not do it for column vector :(
For row vector also its not perfect.

Please help me on how to do it also some tips on how to do the same for a matrix.

Thanks
Adnan

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

Array dimension problem

Post by localghost »

Please, always post full examples so that everybody instantly can comprehend the problem. If I understood you right, the code below should do what you want.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{amsmath}

\begin{document}
\[
  \left\{
  \left[
  \underbrace{%
    \begin{array}{cccc}
      p_2^m & p_1 p_2^m & \cdots & p_1^{n-1} p_2^m
    \end{array}
  }_n
  \underbrace{%
    \begin{array}{cccc}
      p_1^n & p_2 p_1^n &\cdots & p_2^{m-1} p_1^n
    \end{array}
  }_m
  \right]
  \times
  \left[
  \begin{array}{c}
    \frac{\displaystyle \sum_{i=0}^{n-1} q_2^i - q_2^n }{q_2^n} \\
    \frac{\displaystyle \sum_{i=0}^{n-2} q_2^i - q_2^n }{q_2^n} \\
    \vdots \\
    \frac{\displaystyle \sum_{i=0}^{n-(n+1)} q_2^i - q_2^n }{q_2^n} \\
    \frac{1 - q_2^n }{q_2^n} \\
    0 \\
    \vdots \\
    0\\
    \frac{\displaystyle q_1 \sum_{i=0}^{n-1} q_2^i}{q_2^n}
  \end{array}
  \right]
  \right\}
\]
\end{document}
If that is not what you are after, please be more precise in your descriptions.


Best regards and welcome to the board
Thorsten
adnaniut
Posts: 11
Joined: Tue Aug 10, 2010 1:23 am

Re: Array dimension problem

Post by adnaniut »

Hi Thorsten,

Thanks a lot for your reply. Actually I am new into these things and thats why was a little confused about the whole matter.

Your reply solved my problem partially; for the underbrace part. The other part is,
as you divided the whole row vector into two underbraces - n and m, I want to do the same for column vector. I want to use similarly two side braces for the column vector and indicate n and m [only in one side]. So that someone can connect first n number of components in row vector with first n number of components in column vector.

I hope you can understand my problem now.

Thanks again
Adnan
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Array dimension problem

Post by gmedina »

Hi, Adnan

you could try something like the following:

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{amsmath}

\begin{document}
\[
  \left[
  \underbrace{%
    \begin{array}{cccc}
      p_2^m & p_1 p_2^m & \cdots & p_1^{n-1} p_2^m
    \end{array}
  }_n
  \underbrace{%
    \begin{array}{cccc}
      p_1^n & p_2 p_1^n &\cdots & p_2^{m-1} p_1^n
    \end{array}
  }_m
  \right]
  \times
  \left[
  \begin{array}{c}
    \dfrac{\displaystyle\sum_{i=0}^{n-1} q_2^i - q_2^n }{q_2^n} \\[3mm]
    \dfrac{\displaystyle\sum_{i=0}^{n-2} q_2^i - q_2^n }{q_2^n} \\
    \vdots \\
    \dfrac{\displaystyle\sum_{i=0}^{n-(n+1)} q_2^i - q_2^n }{q_2^n} \\[6mm]
    \dfrac{1 - q_2^n }{q_2^n} \\[4mm]
    0 \\
    \vdots \\
    0\\
    \dfrac{\displaystyle q_1 \sum_{i=0}^{n-1} q_2^i}{q_2^n}
  \end{array}
  \right]\hspace*{-6mm}
  \begin{array}{l}
    \left.
    \begin{array}{l}
      \rule{0pt}{6.3cm} % change the value here
    \end{array}
    \right\rbrace n\\
    \left.
    \begin{array}{l}
      \rule{0pt}{4.3cm} % change the value here
    \end{array}
    \right\rbrace m
  \end{array}
\]
\end{document}
Feel free to change the lengths used to control the lengths of the brackets (the corresponding lines are commented in my code with "change the value here")
1,1,2,3,5,8,13,21,34,55,89,144,233,...
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

Array dimension problem

Post by CrazyHorse »

gmedina wrote: Feel free to change the lengths used to control the lengths of the brackets (the corresponding lines are commented in my code with "change the value here")
put it into a \vphantom:

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{amsmath}
\newcommand\dsum{\displaystyle\sum}

\begin{document}
\[
  \left[
  \underbrace{%
    \begin{array}{cccc}
      p_2^m & p_1 p_2^m & \cdots & p_1^{n-1} p_2^m
    \end{array} }_n
  \underbrace{%
    \begin{array}{cccc}
      p_1^n & p_2 p_1^n &\cdots & p_2^{m-1} p_1^n
    \end{array} }_m
  \right]
  \times
  \left[
  \begin{array}{c}
    \dfrac{\dsum_{i=0}^{n-1} q_2^i - q_2^n }{q_2^n} \\[3mm]
    \dfrac{\dsum_{i=0}^{n-2} q_2^i - q_2^n }{q_2^n} \\
    \vdots \\
    \dfrac{\dsum_{i=0}^{n-(n+1)} q_2^i - q_2^n }{q_2^n} \\[6mm]
    \dfrac{1 - q_2^n }{q_2^n} \\[4mm]
    0 \\
    \vdots \\
    0\\
    \dfrac{\dsum_{i=0}^{n-1} q_2^i}{q_2^n}
  \end{array}
  \right]\mkern-15mu
  \begin{array}{l}
    \left.
     \vphantom{
      \begin{array}{c}
      \dfrac{\dsum_{i=0}^{n-1} q_2^i - q_2^n }{q_2^n} \\[3mm]
      \dfrac{\dsum_{i=0}^{n-2} q_2^i - q_2^n }{q_2^n} \\
      \vdots \\
      \dfrac{\dsum_{i=0}^{n-(n+1)} q_2^i - q_2^n }{q_2^n} \\[6mm]
      \end{array} }
    \right\} n\\
    \left.
     \vphantom{
      \begin{array}{l}
      \dfrac{1 - q_2^n }{q_2^n} \\[4mm]
      0 \\
      \vdots \\
      0\\
      \dfrac{\dsum_{i=0}^{n-1} q_2^i}{q_2^n}
      \end{array} }
    \right\rbrace m
  \end{array}
\]
\end{document}
Herbert
adnaniut
Posts: 11
Joined: Tue Aug 10, 2010 1:23 am

Re: Array dimension problem

Post by adnaniut »

Gmedina and Herbert,

Thanks very much for helping me out.

Adnan
adnaniut
Posts: 11
Joined: Tue Aug 10, 2010 1:23 am

Re: Array dimension problem

Post by adnaniut »

Just for consistency in coding, can you guys please advise me on if there is any way of doing the first part of problem similar to that in 2nd part specifying underbrace length.

Thanks
Adnan
Post Reply