About  Knitting  Machines...        
A place for Knitting Machine Enthusiasts
                                                                                      Updated November 2014

A place for Knitting Machine Enthusiasts to find out about Knitting Machines, Yarns or Anything that has to do with Machine Knitting

The Magic formula

The Diophantine Equation
The Magic Formula, also known as the Diophantine Equation, helps chart patterns in the area of necklines, set-in sleeves, shoulder shaping, increases and decreases and more.  It is actually used very often when charting a pattern as you rarely are able to have whole numbers when dividing stitches into rows.  A lot of the times you have a left over, like 2.88 (the .88).

To help things along, I have put together a drop sleeve templates that you can download to use while you are reading this section. 

                                     DROP SLEEVE TEMPLATE

The actual name of the calculation is actually the "Diophantine Equation", it was called and now known also as the "Magic Formula" by ALLES.

As we all know, you cannot have a fraction of a stitch, because you either have 1 (one) stitch or you do not.  You cannot have 1/3 of a stitch or .25 of a stitch.  A stitch is a stitch.  The Magic Formula gets rid of a fraction, or a remainder less than one, and allows an even shaping across all rows.  Speaking of fractions, I change any fractions into decimals, below is the fraction with it's decimal equivalent:

1/8th     =   .125
1/4th     =   .25
3/8ths   =    .5
5/8ths   =    .625
3/4ths   =    .75
7/8ths   =    .875

I am not so picky that I actually use all the decimals/fractions and keep it simple with 1/4 = .25 : 1/2 = .50  :  3/4 = .75.  But if you are that thorough good for you!

The Magic Formula can be used for anything you want to knit and have increases or decreases evenly spaced on both sides of an item, either by necessity or preference.  Even a dog sweater with stripes! 
I will try to explain the math that gets you there and actually do an example of the formula. 


Or you can download a Magic Formula Calculator that sits on your computer from KIDOODLES.  He explains how to install it, as you need to install another freeware program in order to have the calculator work called a "vbrun300.dll".  I had some issues, if you do just email him and he will help.

In order to fully understanding the Magic Formula and pattern charting a must have is a booklet called "CHARTING BY THE MAGIC FORMULA" written by ALLES and published by Country Knitting of Maine.  It shows you how to create patterns from scratch, defines the Magic Formula and uses it through out the book.  By the end you will be able to chart in your sleep and use the Magic Formula blindfolded.

Also, Sandee's Kwik Knits has a CD that you can purchase that has 108 slides that will teach you how to chart garments using the Magic Formula.  I personally have not used it, but I am sure it is a great resource. 

Here is a link to Northtiptons site about the Magic Formula.  All I can say is that she is a lot smarter at math than I am because I was L - O - S - T !  She converts inches to centimeters but for me it is easier to just knit a swatch and use centimeters as a measurement from the beginning.

But, just in case you need to convert inches to centimeters, you can do that with an online calculator that you will find on this link.

                                             Now on to the "MAGIC"...


First a walk down memory lane, grade school math review

Long Division Math Review:
We will be using long division as a means to calculate how to knit up the sleeve and the sleeve cap.

1.  DIVISOR - The number you use to divide by
2.  DIVIDEND - The number to be divided, the number you are dividing
                       8 can go into 24, 3 times, 3 is the QUOTIENT

3.  QUOTIENT - The number of times the DIVISOR fits into the DIVIDEND (it should be a whole number, if it is not use the Magic Formula)

                        8 can go into 30, 3 times (3 x 8 = 24) with 6 left over, so 6 is the REMAINDER

4.  REMAINDER - The number that is left over after the DIVISOR is divided into the DIVIDEND.

This is the math that we use when we figure out how to increase and decrease over a certain number of rows evenly using the Diophantine Equation or Magic Formula.


No need to use the Magic Formula

If you want to shape a sleeve and evenly distribute increases across all rows you would divide stitches by rows.  For instance, the bottom of the sleeve has 20 stitches and the top has 90 stitches.  That means that you would have 70 stitches to increase evenly across all rows.  You get to this number by subtracting the sleeve cuff stitches (20) from the top of the sleeve stitches (90) and you have 70 stitches remaining.

                      90 stitches - 20 stitches = 70 stitches for increasing

BUT, you need to half this number as with a sleeve you increase on BOTH sides, otherwise you will get a lopsided sleeve.  So, now you have 35 stitches.

70 stitches divided by 2 (sides) = 35 stitches

Also, in this example, you know that you have 140 rows to knit the sleeve increases, you know this by your swatch for yarn gauge, the arm measurement or the pattern.  So, you take your rows of 140 and divide "BY" 35 stitches (35 each side is 70) and you get the number 4.  Which is lucky because 140 is divisible by 35.

     140 rows divided by 35 stitches = 4

This means you will add a stitch on each side on every 4th row until you reach 90 stitches, or 35 times.  Simple enough!  

But what happens when you divide rows and stitches but cannot get a whole number?  What do you do with the leftover?  That is where the Magic Formula comes in.                                          

With the next example, #2, you need to look at it like a stack of building blocks.  One calculation builds off of another one.  I have also color coded some of the numbers so it is easier to follow along.
Using the Magic Formula

What was most confusing for me is the use of the number one (1).  I also had to change my thinking on how to divide.  Example #1, I was dividing "BY"   Rows "BY" stitches.  With this example, #2, you will be dividing "INTO" Stitches "INTO" rows.

I will try my best to describe this equation using the Magic Formula...

Let's say you have a sleeve and you have 25 stitches at the cuff and 121 stitches at the shoulder sleeve area.  You take 25 from 121 to find out how many stitches you need to increase, which is 96 stitches.

121 stitches - 25 stitches = 96 stitches to increase

Then you divide 96 by 2 because you increase 1 stitch on each side (I always forget to half the stitches).  So now you have 48 stitches.

     96 stitches divided by 2 (sides) = 48 stitches or increase 48 times
                         Increase 1 stitch on each side 48 times

You know from your test swatch that you have 136 rows to use for increases.  So, you take 136 and divide "BY" 48 and you get 2.833.  I always check to see if I come out with a whole number, or a number that it is divisible by, because then you do not need to use the Magic Formula.

                            136 rows divided by 48 stitches = 2.833
                                           Uh Oh, now what?

Since you have a remainder of ".833" you know that  you now have to switch your thinking and start using the Magic Formula in order to increase evenly across all rows.

NOTE:  First, I am assuming that you are NOT counting the cuff ribbing, if that is what you have done for the edge of the cuff.  I also am assuming you are not counting any rows that you may want to knit at the beginning of the sleeve.  I sometimes crochet cast-on 3 or 4 rows when I do not use ribbing and then knit 2 rows for the cuff for a nice edge.  I also am assuming that the increase is for a Drop Shoulder sleeve, and not a set in sleeve, with say, 5 rows of plain knitting with no changes before I cast off.

   So, you take 136 rows and divide 48 stitches "INTO" 136, NOT DIVIDE BY, you are asking yourself HOW MANY TIMES CAN 48 GO INTO 136.

  48 stitches can go INTO 136 rows 2 times (48 + 48 = 96)
                                                                      ....with 40 stitches left over

We then subtract the remaining stitches (40) from the actual stitches required which is 48 minus 40 is 8.

                                       48 - 40 = 8 stitches

Then add 1 (one) to the number of of how many times the 48 stitches can go into the rows, which is 2, so 2 plus 1 is 3.

You then state that you:

   -Increase 1 stitch at each side at the end of every 2nd row 8 times

   - Increase 1 stitch each side at the end of every 3rd row 40 times

To double check your work...

ROWS should be 136:

       2 rows @   8 times =   16 rows
       3 rows @ 40 times = 120 rows
              TOTAL             136 ROWS

STITCHES should be 96 :
**2 stitches because you increase 1 each side, so you count 2

        2 stitches @   8 times = 16 stitches
        2 stitches @ 40 times = 80 stitches
              TOTAL                  96 STITCHES

Do not ask me how this works out every time, but it does.  You just need to remember the steps, which numbers go where and in which order.  In other words, there is a "direct relationship" with certain numbers and it always works the same way.
Off course, if you do not like doing math you can use any of the online calculators that I have listed on the Knitting Pattern Calculators page.  But, if you do like fooling around with numbers, here is another explanation.  I just found this fascinating to do.

As stated before, if your calculations come out even, there is nothing more to do.  But when there is a remainder of rows or stitches, you need to use the Magic Formula for your knitting pattern.  Now I will do a picture version....

SIDE NOTE:  The top of the drop sleeve is the circumference of the person bicep plus the amount of ease that you added to the rest of the sweater.  So, if you have 2" of ease, and the bicep was 17" = 19".

You have a drop shoulder, moderately tapered sleeves for your sweater.  The dimensions are:

    - Armhole  19"
    - Cuff area   8"
    - Length    20" 

***when measuring a "Drop Down Sleeve" you measure from under the arm to the wrist, any other sleeve you measure from the shoulder to the wrist with a bent arm.

Your gauge from your knitted swatch is:
    6 stitches per inch
    10 rows per inch

                    19 inches x 6 stitches = 114 stitches at the top

                           8 inches x 6 stitches = 48 stitches at the cuff

and the sleeve is 20" tall x 10 rows = 200 rows total for the sleeve

If you have decided to do a ribbed cuff of 2" this means that:

                      2" x 10 rows = 20 rows

but will reset my row counter back to zero once I have transferred all my rib stitches to the main bed.  Always reset, it is easier. 

Instead, I will subtract 5 rows as I am knitting a crochet cast-on 4 times and then knitting 1 row, AND I will knit 3 rows of plain stitching and then casting off, which is another 4 rows
            200 rows - (5 + 4) = 191 rows left to do the shaping

Shaping - I then subtract the 48 stitches that I cast on in stitches from the total at the top of the sleeve:

                     114 - 48 = 66 stitches that I need to use for shaping

I then take 66 stitches and ½ that number as my increases will be on each side of the pattern piece since it is a sleeve:

             66 stitches that I need to shape ÷ 2 sides = 33 stitches 

So, I now have my numbers and I know that...

I cast on 48 stitches with a crochet cast on and knit 3 more rows of the crochet cast on, then 1 row of plain knitting.  That is 5 rows and 48 stitches.

I now have to increase 33 stitches over 191 rows evenly across all rows.          
I take 191 and divide by 33 and I get 5.78, so I know that I need to increase around every 5th row, but what about the .78???

You now switch to the Magic Formula/Diophantine Equation....
Click this link to download a cheat sheet on the Diophantine Equation

Step 1:
How many times can 33 stitches (DIVISOR) go INTO 191 rows (DIVIDEND)?  Well you know about 5 (QUOTIENT) times since you already had figured that out.  So 33 stitches x 5 = 165 stitches with the remainder of 26 stitches (REMAINDER).  (This number must be less than the 33 stitches, or whatever number your calculations were, in this case it was 33).

Step 2:
Take the amount of times 33 (the stitches) can go into 191 (rows), which is 5 and add 1 (one) to it.  Whatever that number is, the QUOTIENT, you always add a 1 (one).  That makes it 6.

                                             5 + 1 = 6  

Step 3:

You also need to subtract the REMAINDER, or remaining stitches (26) from the DIVISOR, which is 33 stitches and you get 7 stitches.

                             33 stitches - 26 stitches = 7 stitches              
Step 4:
Your instructions for the sleeve increases:
   - Increase each side of every (quotient #) 5th (the times 33 goes into 191) row, 7 times (divisor - remainder)
   - Increase each side of every 6th (quotient # + 1) (the times 33 goes into 191, 5 + 1) row (remainder) 26 times (the leftover stitches).

This happens because there is a direct relationship between numbers, and you should consider it as a step, a rule, to get your instructions correct.

Step 5:
Check your work:

      ROWS: I had 191 rows to use for the increases:
                     5 rows x   7 times =  35 rows
                     6 rows x 26 times =  156 rows

                                                                 35 + 156 = 191 rows

      STITCHES: I had to increase evenly using 66** stitches:
**66 because you increase 1 stitch on each side
                     2 stitches   7 times = 14 stitches
                     2 stitches 26 times = 52 stitches

                                                                     14 + 52 = 66 stitches

If you want to learn how to figure out a set in sleeve, there is a page for that in this section.  It is much more complicated, so make sure you understand this page first.  I hope that I have helped and not confused you even more!  LOL


Recommended Texts:

Charting by the Magic Formula published by Country Knitting of Maine
      or email her at:  oth98@hotmail.com

"KNITWEAR designs WORKSHOP, A comprehensive guide to hand knits"
                              Buy it at AMAZON.COM

Website Builder