# Math formatting "Pro tips" edition: Long division at long last! -"?"

Nov 7, 2015

Here's my version of the long division format!

#### Explanation:

Ok, I've been working on this on and off for a couple of days now, ever since Ernest posted his technique here, and I think I finally came up with something very cool and very simple to write, too!

The technique is built around fractions and invisible characters. In a nutshell, you will use fractions and color(white)() to build the long division format line by line.

Before going into the fractions, it's worth noting that the color function works by breaking up the default black text color. So something like

• without the hashtags

x^2 + color(red)(3x) + 2

• with the hashtags

${x}^{2} + \textcolor{red}{3 x} + 2$

is equivalent to

• without the hashtags

color(black)(x^2 + color(red)(3x) + 2)

• with the hashtags

$\textcolor{b l a c k}{{x}^{2} + \textcolor{red}{3 x} + 2}$

Of course, this implies that I can break up other color functions by using color(black)() to return to the default text color

• without the hashtags

color(red)(x^2 + color(black)(3x) + 2

• with the hashtags

color(red)(x^2 + color(black)(3x) + 2

Now, let's say that you have two fractions

$\frac{a + b + c}{a + b + c} \text{ }$ and $\text{ } \frac{d + e + f}{d + e + f}$

If I were to write these two fractions one after the other, i.e. without any spaces between them, i would get

$\frac{a + b + c}{a + b + c} \frac{d + e + f}{d + e + f}$

Now notice what happens when I use color(white)() to make the numerators invisible

$\frac{\textcolor{w h i t e}{\left(a + b + c\right)}}{a + b + c} \frac{\textcolor{w h i t e}{\left(d + e + f\right)}}{d + e + f}$

Now look what happens when I have a fraction completely invisible and use color(black)() to make the denominator visible

• without the hashtags

color(white)( (a + b + c)/color(black)(a + b + c))color(white)((d + e + f))/(d + e + f)

• with the hashtags

$\textcolor{w h i t e}{\frac{a + b + c}{\textcolor{b l a c k}{a + b + c}}} \frac{\textcolor{w h i t e}{\left(d + e + f\right)}}{d + e + f}$

Finally, adding a ")" to the denominator of the second fraction will get me

• without the hashtags

color(white)( (a + b + c)/color(black)(a + b + c))color(white)((d + e + f))/(")" color(white)(x)d + e + f)

• with the hashtags

$\textcolor{w h i t e}{\frac{a + b + c}{\textcolor{b l a c k}{a + b + c}}} \frac{\textcolor{w h i t e}{\left(d + e + f\right)}}{\text{)} \textcolor{w h i t e}{x} d + e + f}$

Now, to demonstarte this further, I'll use a solved example - I picked this one.

So, let's say that you have to write the long division format for $4 {x}^{2} - 2 {x}^{2} + x - 7$ divided by $x - 8$. You would first solve it on paper (I assume that's the case for a lot of people) to get

You would then pair up lines to match the fraction format. To make things clear, I'll use red text to show where the white characters would be used.

• without the hashtags

color(red)( (x-8)/color(black)(x-8)) color(red)( (4x^3 - 2x^2 + x - 7))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)

• with the hashtags - using red

color(red)( (x-8)/color(black)(x-8)) color(red)( (4x^3 - 2x^2 + x - 7))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)

• with the hashtags - using white

color(white)( (x-8)/color(black)(x-8)) color(white)( (4x^3 - 2x^2 + x - 7))/( ")" color(white)(")")4x^3 - 2x^2 + x - 7)

Now set up your fraction pairs. The second segment will start from

$\frac{4 {x}^{3} - 32 {x}^{2}}{4 {x}^{3} + 30 {x}^{2}} \frac{x}{+ x}$

• without the hashtags

(4x^3 - 32x^2)/(color(red)(4x^3 +) 30x^2) color(red)(x/color(black)(+x))

• with the hashtags - using red

$\frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{red}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{red}{\frac{x}{\textcolor{b l a c k}{+ x}}}$

• with the hashtags - using white

$\frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{w h i t e}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{w h i t e}{\frac{x}{\textcolor{b l a c k}{+ x}}}$

The next two-line segment is

$\frac{30 {x}^{2} - 240 x}{30 {x}^{2} - 241 x} \frac{- 7}{- 7}$

• with the hashtags - using red

(30x^2 - 240x)/(color(red)(30x^2 -) 241x) color(red)( (-7)/color(black)(-7)

• with the hashtags - using white

(30x^2 - 240x)/(color(white)(30x^2 -) 241x) color(white)( (-7)/color(black)(-7)

The last two-line segment is

$\frac{241 x - 1928}{241 x - 1921}$

• with the hashtags - using red

$\frac{241 x - 1928}{\textcolor{red}{241 x -} 1921}$

• with the hashtags - using white

$\frac{241 x - 1928}{\textcolor{w h i t e}{241 x -} 1921}$

Finally, put all these together to get

• with the hashtags - using red

color(red)( (x-8)/color(black)(x-8)) color(red)( (4x^3 - 2x^2 + x - 7))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)
$\frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{red}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{red}{\frac{x}{\textcolor{b l a c k}{+ x}}}$
(30x^2 - 240x)/(color(red)(30x^2 -) 241x) color(red)( (-7)/color(black)(-7)
$\frac{241 x - 1928}{\textcolor{red}{241 x -} 1921}$

To space these out, use color(white)() in the beginning of every code line

• with the hashtags - using red

color(red)( (x-8)/color(black)(x-8)) color(red)( (4x^3 - 2x^2 + x - 7))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)
$\textcolor{red}{- \times \times} \frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{red}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{red}{\frac{x}{\textcolor{b l a c k}{+ x}}}$
color(red)(-xxxxxxxxx)(30x^2 - 240x)/(color(red)(30x^2 -) 241x) color(red)( (-7)/color(black)(-7)
$\textcolor{red}{- \times \times \times \times \times \times \times} \frac{241 x - 1928}{\textcolor{red}{241 x -} 1921}$

• with the hashtags - using white

color(white)( (x-8)/color(black)(x-8)) color(white)( (4x^3 - 2x^2 + x - 7))/( ")" color(white)(")")4x^3 - 2x^2 + x - 7)
$\textcolor{w h i t e}{- \times \times} \frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{w h i t e}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{w h i t e}{\frac{x}{\textcolor{b l a c k}{+ x}}}$
color(white)(-xxxxxxxxx)(30x^2 - 240x)/(color(white)(30x^2 -) 241x) color(white)( (-7)/color(white)(-7)
$\textcolor{w h i t e}{- \times \times \times \times \times \times \times} \frac{241 x - 1928}{\textcolor{w h i t e}{241 x -} 1921}$

Finally, use color(black)() to add the terms you need in the numerator of the first fraction

• without the hashtags

color(red)( (x-8)/color(black)(x-8)) color(red)( (color(black)(4x^3 + 30x) x color(black)(+241)))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)

• with the hashtags - using red

color(red)( (x-8)/color(black)(x-8)) color(red)( (color(black)(4x^3 + 30x) x color(black)(+241)))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)

• with the hashtags - using white

$\textcolor{w h i t e}{\frac{x - 8}{\textcolor{b l a c k}{x - 8}}} \frac{\textcolor{w h i t e}{\left(\textcolor{b l a c k}{4 {x}^{3} + 30 x} x \textcolor{b l a c k}{+ 241}\right)}}{\text{)} 4 {x}^{3} - 2 {x}^{2} + x - 7}$

The final product will look like this

• with the hashtags- using red

color(red)( (x-8)/color(black)(x-8)) color(red)( (color(black)(4x^3 + 30x) x color(black)(+241)))/( ")" color(red)(")")4x^3 - 2x^2 + x - 7)
$\textcolor{red}{- \times \times} \frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{red}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{red}{\frac{x}{\textcolor{b l a c k}{+ x}}}$
color(red)(-xxxxxxxxx)(30x^2 - 240x)/(color(red)(30x^2 -) 241x) color(red)( (-7)/color(black)(-7)
$\textcolor{red}{- \times \times \times \times \times \times \times} \frac{241 x - 1928}{\textcolor{red}{241 x -} 1921}$

• with the hashtags - using white

$\textcolor{w h i t e}{\frac{x - 8}{\textcolor{b l a c k}{x - 8}}} \frac{\textcolor{w h i t e}{\left(\textcolor{b l a c k}{4 {x}^{3} + 30 x} x \textcolor{b l a c k}{+ 241}\right)}}{\text{)} 4 {x}^{3} - 2 {x}^{2} + x - 7}$
$\textcolor{w h i t e}{- \times \times} \frac{4 {x}^{3} - 32 {x}^{2}}{\textcolor{w h i t e}{4 {x}^{3} +} 30 {x}^{2}} \textcolor{w h i t e}{\frac{x}{\textcolor{b l a c k}{+ x}}}$
color(white)(-xxxxxxxxx)(30x^2 - 240x)/(color(white)(30x^2 -) 241x) color(white)( (-7)/color(white)(-7)
$\textcolor{w h i t e}{- \times \times \times \times \times \times \times} \frac{241 x - 1928}{\textcolor{w h i t e}{241 x -} 1921}$

Now, as you would imagine, each long division example will have its specific spacing issues, so you're going to have to use color(white)() to create spacing as needed.

So basically, once you set up your fraction pairs, you're good to go!