1. ## Long division

Just wandering how to do long division in latex. Say I want to divide $\frac{x^3+9x^2+28x+34}{x^2+8x+15}.$ The way I did it was as follows. Is there an easier or neater way of doing this? Thanks.

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ x+1\
x^2+8x+15\overline{)x^3+9x^2+28x+34}
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\underline{x^3+8x^2+15x}$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $x^2+13x+34$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\underline{x^2+ \ 8x+15}$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $5x+19$

2. I made long division look sweet using tables. I forget all the exact commands, but if you use \begin{tabular}{c c c c c c}, where each "c" is a column, and you put some term of the polynomial into each column, you can then use \cline within the table to make horizontal lines over specific table cells. You'd also have to use a tricky combination of \multicolumn and \hline to form a horizontal line on exactly one side of one cell, to make it look the way it's supposed to. If you look at Getting to Grips with Latex - Tables - Latex Tutorials by Andrew Roberts @ School of Computing, University of Leeds, all of the basic techniques are there to show you how to do it. It's just time-consuming to get the details right. Maybe when I get within reach of my external hard-drive I'll see if I stored the .tex file where I made a long-division table and post the contents.

3. Originally Posted by acevipa
Just wandering how to do long division in latex. Say I want to divide $\frac{x^3+9x^2+28x+34}{x^2+8x+15}.$ The way I did it was as follows. Is there an easier or neater way of doing this? Thanks.

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $x+1$\newline
$x^2+8x+15\overline{)x^3+9x^2+28x+34}$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\underline{x^3+8x^2+15x}$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $x^2+13x+34$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\underline{x^2+ \ 8x+15}$\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $5x+19$
This is an example copied from a solution set that I had to prepare a few years ago:
$\begin{array}{r@{}rrrrl}
&&x^2&+7x&+10\\
\cline{2-5}
x-3\;|&\;x^3 &+ 4x^2& - 11x& - 25 \\
&x^3&-3x^2 \\
\cline{2-3}
&&7x^2&-11x \\
&&7x^2&-21x \\
\cline{3-4}
&&&10x&-25 \\
\cline{4-5}
\end{array}
$

4. Originally Posted by Opalg
This is an example copied from a solution set that I had to prepare a few years ago:
$\begin{array}{r@{}rrrrl}
&&x^2&+7x&+10\\
\cline{2-5}
x-3\;|&\;x^3 &+ 4x^2& - 11x& - 25 \\
&x^3&-3x^2 \\
\cline{2-3}
&&7x^2&-11x \\
&&7x^2&-21x \\
\cline{3-4}
&&&10x&-25 \\
\cline{4-5}
\end{array}
$
How come an error pops up when I try and do it?

5. Originally Posted by Opalg
This is an example copied from a solution set that I had to prepare a few years ago:
$\begin{array}{r@{}rrrrl}
&&x^2&+7x&+10\\
\cline{2-5}
x-3\;|&\;x^3 &+ 4x^2& - 11x& - 25 \\
&x^3&-3x^2 \\
\cline{2-3}
&&7x^2&-11x \\
&&7x^2&-21x \\
\cline{3-4}
&&&10x&-25 \\