Results 1 to 12 of 12

Math Help - System of Linear Equations

  1. #1
    Senior Member roninpro's Avatar
    Joined
    Nov 2009
    Posts
    485

    System of Linear Equations

    I am interested in typesetting a system of linear equations in a manner demonstrated below. I'm having quite a bit of trouble getting everything to line up. Any suggestions would be appreciated!
    Attached Thumbnails Attached Thumbnails System of Linear Equations-system.jpg  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member Bacterius's Avatar
    Joined
    Nov 2009
    From
    Wellington
    Posts
    927
    Hello,
    interesting question. I know how to get the equations lined up on the "equals" sign, but I never tried to line up every term to a respective position. It doesn't work by using the & symbol repeatedly. Perhaps looking into the array environment, but this would be quite limited and ugly I guess. I'll browse the internet.

    By the way, did you know it was possible to draw a smooth bracket in front of the system (so as to say it is a system), as follows :

    Code:
    \left \{ the system \right.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Banned
    Joined
    Oct 2009
    Posts
    769
    Quote Originally Posted by roninpro View Post
    I am interested in typesetting a system of linear equations in a manner demonstrated below. I'm having quite a bit of trouble getting everything to line up. Any suggestions would be appreciated!
    If I understand you, then you can try putting 0 just in front of the missing variables (e.g. 0x_{1}) and the number 2
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Super Member Bacterius's Avatar
    Joined
    Nov 2009
    From
    Wellington
    Posts
    927
    Yeah but that would be kind of limited and not exactly good looking would it ? Furthermore what if some variable has a two-digit coefficient in front of it, would you put 00 in front of the missing variables just to keep the alignement ? Not to mention that some numbers are larger than others ...

    I'm pretty sure there is a special environment designed for this type of equations but I can't remember the name

    If you are really desperate and don't have any keywords on Google you can still try looking at random mathematical papers (algebraic perhaps) and see how the authors did it in their paper by looking at the tex file ?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Senior Member roninpro's Avatar
    Joined
    Nov 2009
    Posts
    485
    I did run a Google search before I posted this thread. I saw a few articles on the "alignat" environment, but it still wasn't quite what I wanted.

    Messy stuff!
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,492
    Thanks
    1393
    How about...

    <br />
x_1 &+& 2x_2 &-& x_3 &\phantom{+}& \phantom{2x_4} &=& \phantom{-}2 \\<br />
\phantom{x_1} &\phantom{+}& x_2 &-& x_3 &+& 2x_4 &=& -3 \\<br />
-x_1 &-& 2x_2 &+& x_3 &+& x_4 &=& -3<br />

    Hmmm I guess it works differently in LaTeX...
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Use an array:

    \begin{array}{ccccccccccc}
    &x_1&+&2x_2&-&x_3& & &=& &2\\
    & & &x_2&-&x_3&+&2x_4&=&-&3\\
    -&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\
    \end{array}

    gives:

    <br />
\begin{array}{ccccccccccc}<br />
 &x_1&+&2x_2&-&x_3& & &=& &2\\<br />
 & & &x_2&-&x_3&+&2x_4&=&-&3\\<br />
-&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\<br />
\end{array}<br />

    CB
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,492
    Thanks
    1393
    Quote Originally Posted by CaptainBlack View Post
    Use an array:

    \begin{array}{ccccccccccc}
    &x_1&+&2x_2&-&x_3& & &=& &2\\
    & & &x_2&-&x_3&+&2x_4&=&-&3\\
    -&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\
    \end{array}

    gives:

    <br />
\begin{array}{ccccccccccc}<br />
 &x_1&+&2x_2&-&x_3& & &=& &2\\<br />
 & & &x_2&-&x_3&+&2x_4&=&-&3\\<br />
-&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\<br />
\end{array}<br />

    CB
    \begin{array}{cccccccccc}
    \phantom{-}x_1&+&2x_2&-&x_3& & &=& \phantom{-}2\\
    & &\phantom{2}x_2&-&x_3&+&2x_4&=&-3\\
    -x_1&-&2x_2&+&x_3&+&\phantom{2}x_4&=&-3\\
    \end{array}

    looks a bit better...

    \begin{array}{cccccccccc}<br />
\phantom{-}x_1&+&2x_2&-&x_3& & &=& \phantom{-}2\\<br />
 & &\phantom{2}x_2&-&x_3&+&2x_4&=&-3\\<br />
-x_1&-&2x_2&+&x_3&+&\phantom{2}x_4&=&-3\\<br />
\end{array}<br />
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Prove It View Post
    \begin{array}{cccccccccc}
    \phantom{-}x_1&+&2x_2&-&x_3& & &=& \phantom{-}2\\
    & &\phantom{2}x_2&-&x_3&+&2x_4&=&-3\\
    -x_1&-&2x_2&+&x_3&+&\phantom{2}x_4&=&-3\\
    \end{array}

    looks a bit better...

    \begin{array}{cccccccccc}<br />
\phantom{-}x_1&+&2x_2&-&x_3& & &=& \phantom{-}2\\<br />
 & &\phantom{2}x_2&-&x_3&+&2x_4&=&-3\\<br />
-x_1&-&2x_2&+&x_3&+&\phantom{2}x_4&=&-3\\<br />
\end{array}<br />
    Can be done by using {crcrcrcrccl} instead of all centres, so the x's are right justified:

    \begin{array}{crcrcrcrccl}
    &x_1&+&2x_2&-&x_3& & &=& &2\\
    & & &x_2&-&x_3&+&2x_4&=&-&3\\
    -&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\
    \end{array}

    \begin{array}{crcrcrcrccl}<br />
&x_1&+&2x_2&-&x_3& & &=& &2\\<br />
& & &x_2&-&x_3&+&2x_4&=&-&3\\<br />
-&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\<br />
\end{array}

    CB
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,492
    Thanks
    1393
    Quote Originally Posted by CaptainBlack View Post
    Can be done by using {crcrcrcrccl} instead of all centres, so the x's are right justified:

    \begin{array}{crcrcrcrccl}
    &x_1&+&2x_2&-&x_3& & &=& &2\\
    & & &x_2&-&x_3&+&2x_4&=&-&3\\
    -&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\
    \end{array}

    \begin{array}{crcrcrcrccl}<br />
&x_1&+&2x_2&-&x_3& & &=& &2\\<br />
& & &x_2&-&x_3&+&2x_4&=&-&3\\<br />
-&x_1&-&2x_2&+&x_3&+&x_4&=&-&3\\<br />
\end{array}

    CB
    What I did was move the negatives next to the numbers though...
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Prove It View Post
    What I did was move the negatives next to the numbers though...
    If you want that it is trival to do (put the signs for the first volumn with the variable (and if you must delete the first c in the braces and the first & in the code)), but I wanted uniform spacing for all the terms.

    CB
    Follow Math Help Forum on Facebook and Google+

  12. #12
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    You can leave spaces in such a way as to align the various terms by using the \phantom command.

    \begin{aligned}
    x_1 + 2x_2 - x_3 \phantom{{}+2x_4} &= \phantom{-}2, \\
    x_2 - x_3 + 2x_4 &= -3, \\
    -x_1 - 2x_2 + x_3 + \phantom{2}x_4 &= -3.
    \end{aligned}

    \begin{aligned}<br />
x_1 + 2x_2 - x_3 \phantom{{}+2x_4} &= \phantom{-}2, \\<br />
x_2 - x_3 + 2x_4 &= -3, \\<br />
-x_1 - 2x_2 + x_3 + \phantom{2}x_4 &= -3.<br />
\end{aligned}

    Edit. I see that Prove_It has already suggested using \phantom. But if you do so in the aligned environment rather than the array environment, then the spacing looks much better.
    Last edited by Opalg; July 2nd 2010 at 12:51 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. System of linear equations
    Posted in the Advanced Algebra Forum
    Replies: 4
    Last Post: January 7th 2011, 06:09 PM
  2. System of linear equations.
    Posted in the Algebra Forum
    Replies: 6
    Last Post: October 29th 2010, 03:48 PM
  3. Replies: 2
    Last Post: April 20th 2010, 03:26 PM
  4. System of Linear Equations?
    Posted in the Number Theory Forum
    Replies: 7
    Last Post: March 2nd 2010, 04:35 PM
  5. system of linear equations
    Posted in the Algebra Forum
    Replies: 8
    Last Post: May 20th 2008, 06:17 AM

Search Tags


/mathhelpforum @mathhelpforum