Synthetic and polynomial long division

  • Context: MHB 
  • Thread starter Thread starter MarkFL
  • Start date Start date
  • Tags Tags
    Division Polynomial
Click For Summary
SUMMARY

This discussion focuses on displaying synthetic and polynomial long division techniques using the array environment in LaTeX. The example provided demonstrates how to perform the division of the polynomial \(x^2 + 2x + 1\) by \(x + 1\), yielding a quotient of \(x + 1\). Key LaTeX commands such as \texttt{\textbackslash begin\{array\}} and \texttt{\textbackslash hline} are highlighted for formatting the division steps. Additionally, the discussion mentions the use of specific LaTeX packages like \texttt{longdiv} and \texttt{polynom} for enhanced polynomial division representation.

PREREQUISITES
  • Familiarity with LaTeX typesetting
  • Understanding of polynomial division concepts
  • Knowledge of LaTeX array environment syntax
  • Experience with LaTeX packages such as \texttt{longdiv} and \texttt{polynom}
NEXT STEPS
  • Explore advanced LaTeX array formatting techniques
  • Learn how to implement the \texttt{longdiv} package for division
  • Investigate the \texttt{polynom} package for polynomial operations
  • Study how to define custom macros in MathJax for enhanced functionality
USEFUL FOR

Mathematicians, educators, and students who are looking to improve their LaTeX skills for displaying polynomial division and related mathematical concepts effectively.

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

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 14 ·
Replies
14
Views
2K