Program "FACTOR"

Purpose: Given a quadratic expression of the form , factor into the form of two binomials (mx+n)(ux+v). The program returns the values of m,n,u, and v. It utilizes"If-Then-Else", "While" loops, and calls a subroutine pgrmGCF.

There are two ways to factor a trinomial--"guess and check" and a method I like to call "tic-tac-toe." "Guess and check" involves listing the factors of a and c and substituting them into the skeleton (__x +__)(__x+__) until you find two binomials that multiply to get the original trinomial. Because "guess and check" involves a bit of instinct from the problem solver, it is more difficult to formalize the algorithm in terms the calculator can understand. The TI-83 has no "instinct."

Tic-Tac-Toe

Why "tic-tac-toe"? The algorithm can be easily organized into a 3x3 grid.

 1 2 3 7 8 4 6 9 5

Notice the funny order in which the boxes are numbered. They will be filled in this order. Here is an example to demonstrate the algorithm.

Consider the statement . (It is wise to practice when the answer is known in order to affirm the algorithm works.) Here we can see that a=3, b=-19, c=-14, m=3, n=2, u=1, and v=-7.

Box 1: Enter ax^2.

Box 2: Enter c.

Box 3: Enter the product of Box 1 and Box 2, or c*ax^2.

At this point you should have the following:

 3x^2 -14 -42x^2

Make to enter a and c exactly as they are, that is carry their signs with them. Now look for factor pairs of a*c that add to be b. It is helpful to list the factor pairs of -42 to the side. Hmmm.....

1 and 42

2 and 21

Well, -21*2=42 and -21+2=-19=b. We have found our factor pair!

KEY to filling in grid correctly: Rows work such that the bottom row times the middle row equals the entry in the top row. The columns work similarly where the first row times the second row equals the third row. (Just like Box 1*Box 2 = Box 3).

Hence Box 5*Box 4 must equal Box 3. Because of this, the variables must be in boxes 4 & 5 as well (-21x and 2x). Due to the commutative property, it does not matter which factor you place in which box. I will place them in the following order.

 3x^2 -14 -42x^2 2x -21x

Box 6: The (positive) Greatest Common Factor of Box 1 and Box 5.

The greatest common factor of 3x^2 and -21x is 3x.

Now by the "KEY" boxes 7, 8, and 9 can be filled with division. Check that all rows multiply across, and all columns multiply upwards after completing the grid.

 3x^2 -14 -42x^2 x 2 2x 3x -7 -21x

Clearly from the known solution, we can see that boxes 6 and 8 correspond with one binomial and boxes 7 and 9 correspond with the other. The coefficient m=3, the coefficient u=1. The constants n and v equal 2 and -7, respectively.

On paper, the grid is convenient for organizing the information. On the calculator, however, commands can be used to follow the algorithm without a grid.

Just like the programs before, you must start by prompting the user for input--a, b, and c.

You must realize that programs are not unique. There are multiple ways to write algorithms. I used the "IF" commands (with which you should already be familiar) along with a "While" loop and a subroutine.

Try writing some code that performs the algorithm.

Consider these possible problems or "glitches":

What if the trinomial is unfactorable/prime? Can you test this before beginning the factoring algorithm?

One glitch I ran into was in my initial while loop. I chose to increment by 1 in order to determine my factor pairs. What happens when you try to factor zero? An error message! How can this be prevented?

For my complete program, click here.