Results 1 to 7 of 7

Math Help - Multiline addition with carries

  1. #1
    Junior Member
    Joined
    Oct 2009
    Posts
    31

    Multiline addition with carries

    I can't figure out how to display a multiline addition in latex with carried numbers... Could anyone show me how to do this neatly?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Oct 2009
    Posts
    31
    I figured out how to do the numbers that are carried over by using \overset{}, but how do I get a shorter line between the added number and the result? Now it fills all the page from left to middle....

    Here's the code (I just posted it like this since it didn't render with the math tags..):
    \begin{align*}
    & \overset{1}{\ }\overset{1}{{1}}\overset{1}{0}\overset{1}{{1}}1_{ 2}\\
    + & \ \ \ 111_{2}\\
    \hline & 10010\end{align*}
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Junior Member
    Joined
    Oct 2009
    Posts
    31
    Ok I figured I could just do this:

    \begin{minipage}[t]{40pt}%
    \begin{align*}
    & \overset{1}{\ }\overset{1}{{1}}\overset{1}{0}\overset{1}{{1}}1_{ 2}\\
    + & \ \ \ 111_{2}\\
    \hline & 10010\end{align*}
    %
    \end{minipage}

    Not the most elegant solution, so if anyone has a better way to do this (there must be, this is simple maths!!:P)...
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by Jodles View Post
    Not the most elegant solution, so if anyone has a better way to do this (there must be, this is simple maths!!:P)...
    Simple maths doesn't necessarily mean simple LaTeX! This is also not elegant LaTeX, but it produces a fairly neat result:
    Code:
    \begin{array}{c@{\:}c@{\:}c@{\:}c@{\:}c@{\,}c}
    ^{^1}&^{^1}&^{^1}&^{^1}\vspace{-2ex}\\
    &1&0&1&1&_2\\
    \llap{+}&&1&1&1&_2\\
    \hline
    1&0&0&1&0\\
    \end{array}
    \begin{array}{c@{\:}c@{\:}c@{\:}c@{\:}c@{\,}c}<br />
^{^1}&^{^1}&^{^1}&^{^1}\vspace{-2ex}\\<br />
&1&0&1&1&_2\\<br />
\llap{+}&&1&1&1&_2\\<br />
\hline<br />
1&0&0&1&0\\<br />
\end{array}<br />
    Last edited by Opalg; November 13th 2010 at 01:24 PM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Oct 2009
    Posts
    31
    Many thanks, Opalg!

    That produces a much more cleaner result!

    Sometimes the simplest things seem the most difficult...
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Junior Member
    Joined
    Oct 2009
    Posts
    31
    While we're on it. I modified the above for subtraction:
    \begin{array}{c@{\:}c@{\:}c@{\:}c@{\:}c@{\:}c@{\:}  c@{\:}c@{\,}c} ^{^{}}&^{^{}}&^{^{}}&^{^{10}}&^{^{10}}&^{^{10}}&^{  ^{10}}\vspace{-2ex}\\ <br />
1&0&1&1&0&0&0&_2\\ <br />
\llap{-}0&0&0&1&0&1&1&_2\\ <br />
\hline <br />
1&0&0&1&1&0&1_2\\ <br />
\end{array}

    But how would I be able to show that the borrowed 10's are striked out? I tried with \sout{}, but that oddly enough adds a line under the number instead of through...
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Junior Member
    Joined
    Oct 2009
    Posts
    31
    I shouldn't be so quick to ask.. In math environment: \usepackage{cancel}, and \cancel{24324}, instead of \sout{}.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Is R-P closed under addition?
    Posted in the Advanced Algebra Forum
    Replies: 3
    Last Post: December 5th 2011, 09:37 PM
  2. Addition of secants
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: September 20th 2010, 04:12 AM
  3. Addition problem
    Posted in the Algebra Forum
    Replies: 3
    Last Post: April 19th 2009, 12:11 PM
  4. Commutativity of Addition
    Posted in the Advanced Algebra Forum
    Replies: 5
    Last Post: July 8th 2007, 06:36 PM
  5. addition
    Posted in the Math Topics Forum
    Replies: 4
    Last Post: July 18th 2006, 08:31 AM

Search Tags


/mathhelpforum @mathhelpforum