# Primary mathematics/Method for factoring

## A method of prime factorization for children

In math, the way you get to the correct answer is just as important as getting the right answer. Sometimes the way one gets the answer can be thought of as a proof. People don't usually use the word "proof" when talking about arithmetic problems, but it's a good idea and good habit to get into. This is a method of prime factorization that constructs a proof that your answer is correct as you arrive at the answer. It keeps you from getting lost and also shows your work. More importantly, it helps you understand the process. It starts out very easy, so that beginners can use it, but later on lets you skip some steps to save time.

The basic point of prime factorization is to take a number and find the prime factors. Since each prime factor may occur more than once, for example in the number 4, which has prime factors (2,2), we know that the factors of a number are not a set but a multi-set. (The difference will be important as you get to more advanced math.) So the basic way we are going to do our work looks like this:

```   pf(X)
= {a reason we believe this}
(a list of factors)
```

For example, for the number 4, we could factorize it like this:

```   pf(4)
= {4 = 2×2}
(2,2)
```

This is a very simple proof, and also represents what is sometimes called "showing our work" or "scratch paper". Learning math is often about learning the language and symbols of math, and we need to do that now.

Use the symbol pf(X) to mean "the prime factors of X". Use a comma separated list of numbers of "pf(X)" symbols between parentheses to mean a multi-set of prime factors. So (pf(45),2,5) means "multi-set that includes the prime-factors of 45 and the prime number 2 and the prime number 5".

Now, for doing prime factorization, we are only going to allow certain reasons to go from one step to the next toward the answer. For example, "my friend Harold said so" is not a good reason.

The first reason that we will allow is a simple multiplication equation of the form x = y×z. In particular, we are allowed to do this:

```   pf(x)
= {x = y×z}
(pf(y),pf(z))
```

so long as the equation x = y×z is true (and y and z are both greater than 1, otherwise we'd be going in circles!)

The second rule that we are allowed to use is to replace pf(x) with (x) if we know for sure that x is a prime. For example, you should probably memorize the first ten primes: (2, 3, 5, 7, 11, 13, 17, 19, 23, 29), so it's OK to substitute the number 23 for pf(23), since we should know by heart that 23 is prime. When we do this, we give the reason "23 is prime".

Finally, we need to note that ((X)) = (X), no matter what X is , so we never need to write parentheses inside parentheses (this is not true of multiplication, it is only true because we are using parentheses to mean something special.

So let's do an example:

```   pf(4)
= {4 = 2×2}
(pf(2), pf(2)
= {2 is prime}
(2,2)
```

So, in this example, we've chained together two steps, with a reason for each one that is very simple. This is a good idea when you are starting out. However, mathematicians also want to be efficient, so if you are sure of what you are doing, you could do two steps at once:

```   pf(4)
= {4 = 2×2, 2 is prime}
(2,2)
```

Notice that whether we perform one, two, or even more steps, we are really creating an equation. If we drop out the intermediate steps, the result is pf(4) = (2,2), which is probably about what someone would want on a test.

Now let's do a harder one:

```   pf(60)
= {60 = 6×10}
(pf(6), pf(10))
= {6 = 2×3, 10 = 2×5}
(2,3,2,5)
= {commutativity of multiplication}
(2,2,3,5)
```

Commutativity of multiplication is a rule that just lets us reorder the factors. It's nice to have them in order in our list, so we will often do that at the end. But that's a lot of writing, so we'll abbreviate it {com. of mult.} Also, notice that in the second step we dropped the unnecessary parentheses, instead of writing ((2,3), (2,5)).

Now let's do an even bigger one, that's still easy, since the prime factors are all small, and it's easy to see the factors.

```   pf(450)
= {450 = 45×10}
(pf(45), pf(10)}
= {45 = 5×9, 10 = 2×5}
(5,pf(9),2,5)
= {9 = 3×3 , com. of mult.}
(2,3,3,5,5)
```

Now we see a way in which we could have made a mistake --- if we forgot that 9 is not prime and had written (5,9,2,5). Hopefully we would have noticed, but we need to be careful!

## When the factors aren't obvious

This is a nice method when the factors are easy to see. But, unfortunately, sometimes they aren't easy to see at all, and we need a new symbol for expressing our work in that case.

Consider the number 143. Is it prime, or does it have factors? Well, it's not obvious. The basic approach to finding any factor, or proving that a number is prime, is to start at the first prime (the number 2) and see if it's a factor. By going systematically up through each prime, we either find a factor or reach a prime that is bigger than the square root of the number, in which case we know the number is prime.

However, this is sometimes a big job, and we would really like to show our work in a way that helps us keep track of where we are and also can be quickly checked to make sure we haven't made any mistakes.

The way we can do this is with the symbol nu(X,Y), which means "the multi-set of prime factors of Y, understanding that none of the numbers up to and including X evenly divide Y". We're thus using the "not divisible up to" function nu both to help remember what has already been checked, but we've defined it so that the equation remains technically true at all times. The reason we want this symbol is that we know that is how you prove something is prime---you prove nu(sqrt(Y),Y), and then you know Y is prime. For example, if you know nu(13, 123), you know 123 is prime since 13×13 > 123. We can introduce nu(2,X) with the reason {X is not even}. If we know nu(2,X), then we can introduce nu(3,X) with the reason {sum of X's digits not divisible by 3}.

So let's try this:

```   pf(143)
= { 143 is not even }
(nu(2,143))
= { 1+4+3 not divisible by 3 }
(nu(3,143))
= { 143 doesn't end in 5 or 0 }
(nu(5,143))
= { 143 / 7 = 203/7 }
(nu(7,143))
= { 143 / 11 = 13!!}
(11,pf(13))
= { 13 is prime }
(11,13)
```

So that is our answer. Now, in this case, we had to use a reason that we derived by division: 143/7 is not a whole number, but 203/7. And, we were surprised to learn that 11 evenly divides 143. Let's try an even harder one. (Note, we are using the divisibility test from the Dr. Math website , rather than doing division for many of these divisibility tests at noted, but if we had to do it on a test, we would use division, if we don't have those rules memorized.)

```   pf(1709)
= { not even, digits don't sum to a multiple of 3, doesn't end in 5 or 0 }
(nu(5,1709))
= { not divisible by 7 }
(nu(7,1709))
= { not divisible by 11 }
(nu(11,1709))
= { not divisible by 13 }
(nu(13,1709))
= { not divisible by 17 }
(nu(17,1709))
= { not divisible by 19 }
(nu(19,1709))
= { not divisible by 23 }
(nu(23,1709))
= { not divisible by 29 }
(nu(29,1709))
= { not divisible by 31 }
(nu(31,1709))
= { not divisible by 37 }
(nu(37,1709))
= { not divisible by 41 }
(nu(41,1709))
= { not divisible by 43, and 432>1709, so by nu rule we are done!}
(1709)
```

By systematically working our way up from 2 to the square root of the number, we can always keep track of where we are. For example, if we had started with 6×1709 = 10254, we would have ended up with:

```   pf(10254)
= { even }
(2,pf(5127))
= {5+1+2+7=15 = 3×5 }
(2,3,pf(1709))
.....
(2,3,1709)
```

and then the proof would proceed as it did above, carrying with it the prime factors 2 and 3 the whole time.

This way of writing out your work is recommended. It works well for the child who will have trouble factorizing 54, and well for the child factorizing 10254. It builds good habits that will pay off in algebra and other more advanced mathematical calculation, and introduces, gently, the all-important concept of the proof.

One sometimes see factor trees suggested as a notation. Factor trees may be useful for visualizing some things but are not useful at all if one can't see the factors!
{"ft_lang_label":"__label__en","ft_lang_prob":0.9567704,"math_prob":0.99447894,"size":8153,"snap":"2022-05-2022-21","text_gpt3_token_len":2294,"char_repetition_ratio":0.13559946,"word_repetition_ratio":0.01603592,"special_character_ratio":0.31779712,"punctuation_ratio":0.1281912,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9991929,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-24T18:11:24Z\",\"WARC-Record-ID\":\"<urn:uuid:98e7cc93-9b60-4956-9491-df6d98969916>\",\"Content-Length\":\"38729\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6b24e290-fc8f-4d0b-b2dd-effb87ab1abd>\",\"WARC-Concurrent-To\":\"<urn:uuid:b6a83b7c-dfdc-4222-b10e-104481fe8c81>\",\"WARC-IP-Address\":\"208.80.154.224\",\"WARC-Target-URI\":\"https://en.wikiversity.org/wiki/Primary_mathematics:Method_for_Factoring\",\"WARC-Payload-Digest\":\"sha1:BFFQXYS7EHAW73VB5Y4BKRDIBAEQJNLB\",\"WARC-Block-Digest\":\"sha1:KHPAMDLV4HK6NJPVXEH5HTQCOWYAUSOW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662573189.78_warc_CC-MAIN-20220524173011-20220524203011-00383.warc.gz\"}"}