MHB Synthetic and polynomial long division

AI Thread Summary
The discussion focuses on displaying division techniques in LaTeX, particularly using the array environment for synthetic and polynomial long division. The array environment allows for structured formatting, with specific commands for alignment and separation of elements. The synthetic division example demonstrates how to set up a centered column with right-aligned columns, utilizing the \hline command for horizontal lines. For polynomial long division, a single right-aligned column is used, with the \underline command to indicate subtractions. The conversation also touches on LaTeX packages that facilitate division, such as longdiv and polynom, and notes that MathJax does not support certain LaTeX document-level commands, which may limit its functionality in displaying these divisions. The thread emphasizes the potential for future enhancements in MathJax to better support these mathematical representations.
MarkFL
Gold Member
MHB
Messages
13,284
Reaction score
12
Until now, I have avoided trying to display techniques of division using $\LaTeX$ because there just didn't seem to be a nice way to carry it out. However, we may use the array environment for the display of synthetic and polynomial long division methods very nicely.

I will demonstrate how to use the array environment to show that:

$$\frac{x^2+2x+1}{x+1}=x+1$$

using the two methods of division commonly taught to algebra students, i.e., synthetic and polynomial long division.

First, let's discuss the array environment. To define an array you may use the tags:

Code:
\begin{array} and \end{array}

Next, you need to define how many columns there will be and what the alignment of those columns should be. You use "l" for left, "c" for center, and "r" for right. Each row needs to be defined using one of these three characters. By placing the vertical bar character "|" in between two columns in this alignment definition, you can cause a vertical bar to be displayed in the array. Each row in the array is separated by a double backslash "\\" and each element in the rows is separated by an ampersand "&". Data elements may be blank as well.

Synthetic division

The first column may be center-aligned, and then a vertical bar should separate the first column from the others, which should all be right-aligned.

The $\LaTeX$ code:

Code:
\begin{array}{c|rrr}&1&2&1\\-1&&-1&-1\\\hline\\&1&1&0\\\end{array}

produces:

$$\begin{array}{c|rrr}&1&2&1\\-1&&-1&-1\\\hline\\&1&1&0\\\end{array}$$

Notice that the \hline command produces a horizontal line.

Polynomial long division

Here we may use just one right-aligned column for our array.

The $\LaTeX$ code:

Code:
\begin{array}{r}x+1\\x+1\enclose{longdiv}{x^2+2x+1}\\-\underline{\left(x^2+x\right)}\hspace{1.5em}\\x+1\hspace{.33em}\\-\underline{(x+1)}\\0\hspace{.33em}\\\end{array}

produces:

$$\begin{array}{r}x+1\\x+1\enclose{longdiv}{x^2+2x+1}\\-\underline{\left(x^2+x\right)}\hspace{1.5em}\\x+1\hspace{.33em}\\-\underline{(x+1)}\\0\hspace{.33em}\\\end{array}$$

The first row contains the quotient, and the second row should be of the form:

divisor\enclose{longdiv}{dividend}

The \underline{expression} command may be used where subtractions are carried out.

Notice that the horizontal space command \hspace{#em} may be used to introduce white space at the end of rows to align the data as needed. You may have to experiment some to get it just right. :D
 
Physics news on Phys.org
For writing \(\LaTeX\) documents, there are two options for division of numbers and \(\LaTeX\) does the math for you as well. These options are
Code:
\input{longdiv}
\usepackage{xlop} %  Be warned French division style
For polynomial divison, we have the following
Code:
\usepackage{polynom}
mg7H8UD.png

Code:
\documentclass{article}
\input{longdiv}
\usepackage{subcaption}
\usepackage{xlop}% http://www.ctan.org/pkg/xlop
\usepackage{polynom}% http://www.ctan.org/pkg/polynom
\begin{document}
\begin{figure}
  \subcaptionbox{}{\longdiv{15}{3}}
  \qquad
  \subcaptionbox{}{\longdiv{17}{3}}
  \qquad
  \subcaptionbox{}{\opdiv{15}{3}}
  \qquad
  \subcaptionbox{}{\opdiv{17}{3}}
\end{figure}

\begin{figure}
  \subcaptionbox{Style A}{\polylongdiv[style = A]{x^2 + 2x + 1}{x + 1}}
  \qquad
  \subcaptionbox{Style B}{\polylongdiv[style = B]{x^2 + 2x + 1}{x + 1}}\\
  \subcaptionbox{Style C}{\polylongdiv[style = C]{x^2 + 2x + 1}{x + 1}}
\end{figure}

\begin{figure}
  \polyhornerscheme[x = 1]{x^2 + 2x + 1}
\end{figure}
\end{document}
If MHB will (or can) load these packages, we would have these abilities within Math Jax
 
I quote some information I found online:

MathJax does not support either the \documentclass or \usepackage macros, so strictly speaking, MathJax does not support LaTeX style files. Usually in LaTeX, style files are used to establish document-level formatting (as in the LaTeX article and letter styles), which MathJax simply does not do -- that is handled by HTML. There are a few other common style file tricks that MathJax does not support, like catcodes.

MathJax does support defining new macros, though, either with \newcommand (within a MathJax LaTeX block) or in the Macros section of the MathJax configuration (which requires some JavaScript).

So, it would seem that such functionality would have to be coded by us. Now, I certainly can't make any guarantees at this stage, but it will be something I will be looking into for the future of MHB and our implementation of MathJax.
 

Similar threads

Back
Top