Results 1 to 7 of 7

Math Help - underbraces inside array

  1. #1
    Newbie
    Joined
    Jan 2008
    Posts
    5

    underbraces inside array

    Hi,

    I have the following expression:

    <br />
\begin{array}{cclclclclcl}<br />
= &   & 2^{k-2} \\<br />
  & + & 2^{k-3} & + & 2^{k-3} \\<br />
  & + & 2^{k-4} & + & 2^{k-4} & + & 2^{k-4} \\<br />
  & \vdots \\<br />
  & + & 2^1 & + & 2^1 & + & \dots & + & 2^1 \\<br />
  & + & 2^0 & + & 2^0 & + & \dots & + & 2^0 & + & 2^0 \\<br />
\end{array}<br />

    It is set inside an array because of the + alignment. I would like to add underbraces under the two bottom rows, such as this:

    <br />
+ \quad \underbrace{2^1 \quad + \quad 2^1 \quad + \quad \dots \quad + \quad 2^1}_{k-2}<br />
    <br />
+ \quad \underbrace{2^0 \quad + \quad 2^0 \quad + \quad \dots \quad + \quad 2^0 \quad + \quad 2^0}_{k-1}<br />

    However, I would still like to retain the vertical alignment of all the + signs in all rows, so I need to somehow put these underbraces inside the array. (Or use array inside an array, but I can't figure exactly how.)

    Do you know any way to do this? Thanks!
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    earboth's Avatar
    Joined
    Jan 2006
    From
    Germany
    Posts
    5,829
    Thanks
    123
    Hello,

    maybe this reply http://www.mathhelpforum.com/math-help/94284-post2.html helps a little bit further.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2008
    Posts
    5
    Quote Originally Posted by earboth View Post
    Hello,

    maybe this reply http://www.mathhelpforum.com/math-help/94284-post2.html helps a little bit further.
    It doesn't

    I could do the bottom brace that way, but there would still be a problem with the inner one.

    Also, I could put all the stuff above the inner brace into an array and then put the brace under this array, and the whole thing would be in a bigger array with the second brace under itself, but one problem still remains - the +'s in the bottom line (which is outside the inner array, but inside the outer one) would not be aligned with the +'s in the inner array (which they are out of).
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Math Engineering Student
    Krizalid's Avatar
    Joined
    Mar 2007
    From
    Santiago, Chile
    Posts
    3,654
    Thanks
    12
    How about

    \begin{split} <br />
&=  2^{k-2}  \\ <br />
& \quad +  2^{k-3}  +  2^{k-3} \\ <br />
& \quad+  2^{k-4}  +  2^{k-4}  +  2^{k-4} \\ <br />
&\quad \quad \vdots \\ <br />
& \quad +  \underbrace{2^1  +  2^1  +  \cdots  +  2^1}_{k-2} \\ <br />
& \quad +  \underbrace{2^0  +  2^0  +  \cdots  +  2^0  +  2^0}_{k-1}. <br />
\end{split}

    ?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Senior Member JaneBennet's Avatar
    Joined
    Dec 2007
    Posts
    293
    \begin{array}{ccl}<br />
= & {} & 2^{k-2}\\<br />
{} & + & 2^{k-3}\ +\ 2^{k-3}\\<br />
{} & + & 2^{k-4}\ +\ 2^{k-4}\ +\ 2^{k-4}\\<br />
{} & {} & \vdots\\<br />
{} & + & \underbrace{2^1\quad\;+\ 2^1\quad\;+\ \ldots\ +\ 2^1}_{k-2}\\\\<br />
{} & + & \underbrace{2^0\quad\;+\ 2^0\quad\;+\ \ldots\ +\ 2^0\ +\ 2^0}_{k-1}<br />
\end{array}
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    Jan 2008
    Posts
    5
    Quote Originally Posted by Krizalid View Post
    How about

    \begin{split} <br />
&=  2^{k-2}  \\ <br />
& \quad +  2^{k-3}  +  2^{k-3} \\ <br />
& \quad+  2^{k-4}  +  2^{k-4}  +  2^{k-4} \\ <br />
&\quad \quad \vdots \\ <br />
& \quad +  \underbrace{2^1  +  2^1  +  \cdots  +  2^1}_{k-2} \\ <br />
& \quad +  \underbrace{2^0  +  2^0  +  \cdots  +  2^0  +  2^0}_{k-1}. <br />
\end{split}

    ?
    Thanks, but it doesn't keep the vertical alignment of +'s, so not exactly what I needed.

    Quote Originally Posted by JaneBennet View Post
    \begin{array}{ccl}<br />
= & {} & 2^{k-2}\\<br />
{} & + & 2^{k-3}\ +\ 2^{k-3}\\<br />
{} & + & 2^{k-4}\ +\ 2^{k-4}\ +\ 2^{k-4}\\<br />
{} & {} & \vdots\\<br />
{} & + & \underbrace{2^1\quad\;+\ 2^1\quad\;+\ \ldots\ +\ 2^1}_{k-2}\\\\<br />
{} & + & \underbrace{2^0\quad\;+\ 2^0\quad\;+\ \ldots\ +\ 2^0\ +\ 2^0}_{k-1}<br />
\end{array}
    Thanks, this looks pretty much like what I needed - but as I understand it, you just approximated the spaces to keep the alignment, so if I add/change something, I would have to approximate and change the spaces in all rows, so it is kind of unpractical if I want to use it more often. Also, I think the alignment is not 100% precise.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by johny View Post
    Thanks, this looks pretty much like what I needed - but as I understand it, you just approximated the spaces to keep the alignment, so if I add/change something, I would have to approximate and change the spaces in all rows, so it is kind of unpractical if I want to use it more often. Also, I think the alignment is not 100% precise.
    If you really want 100% precise alignment then you can use TeX's \rlap and \hphantom routines to write a superscript 1 that takes up exactly the same amount of space as k–4. The input looks like this:

    Code:
    \begin{array}{cl}
    = & \hphantom{{}+{}}  2^{k-2}\\
    &{}  +  2^{k-3} + 2^{k-3}\\
    &{} +  2^{k-4} + 2^{k-4} + 2^{k-4}\\
    & \hphantom{{}+{}} \vdots\\
    &{} +  \underbrace{2^{\rlap{$\scriptstyle1$}\hphantom{k-4}} + 2^{\rlap{$\scriptstyle1$}\hphantom{k-4}} + \ldots + 2^1}_{k-2}\vspace{.5ex}\\
    &{} +  \underbrace{2^{\rlap{$\scriptstyle0$}\hphantom{k-4}} + 2^{\rlap{$\scriptstyle0$}\hphantom{k-4}} + \ldots + 2^0 + 2^0}_{k-1}
    \end{array}
    I can't show the complete output here, because the LaTeX string is too long for the MathHelpForum's compiler to accept. But it works nicely with the TeX program on my computer. If I leave out a couple of lines to bring it down to MathHelpForum's 400-character limit then it looks like this:

    \begin{array}{cl}<br />
= & \hphantom{{}+{}}  2^{k-2}\\<br />
&{} +  2^{k-4} + 2^{k-4} + 2^{k-4}\\<br />
&{} +  \underbrace{2^{\rlap{$\scriptstyle1$}\hphantom{k-4}} + 2^{\rlap{$\scriptstyle1$}\hphantom{k-4}} + \ldots + 2^1}_{k-2}\vspace{.5ex}\\<br />
&{} +  \underbrace{2^{\rlap{$\scriptstyle0$}\hphantom{k-4}} + 2^{\rlap{$\scriptstyle0$}\hphantom{k-4}} + \ldots + 2^0 + 2^0}_{k-1}<br />
\end{array}
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Array Help
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: January 31st 2011, 06:42 AM
  2. Area inside cardioid and also inside circle??
    Posted in the Calculus Forum
    Replies: 3
    Last Post: April 19th 2010, 05:57 PM
  3. Number array
    Posted in the Number Theory Forum
    Replies: 3
    Last Post: October 24th 2009, 01:50 AM
  4. array help
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: October 12th 2008, 04:42 PM
  5. array
    Posted in the LaTeX Help Forum
    Replies: 3
    Last Post: October 8th 2008, 12:43 PM

Search Tags


/mathhelpforum @mathhelpforum