1 2 3 4
1 1 1
This pattern means it is a quadratic sequence. I can now use a formula to work a formula for this sequence.
2a = 1
a = 0.5
3a + b = 1
1.5 + b = 1
b = -0.5
a + b + c = 0
0.5 - 0.5 + c = 0
c = 0
an + bn + c
0.5n2 - 0.5n
I have now found a formula which can be used to work out the number of switches required for any number of buns. I will now test the formula to see if it is correct. I will test the formula with the number 3. The outcome according to my table should be 3.
0.5 * 32 - 0.5 * 3 = 3
I will now prove my formula is correct using induction. In order to do this I will have to show two things. Firstly I will need to show that the formula is true when n is equal to k, k being the number of each type of bun. I will also need to see that n = the successor of k (k+1). Secondly I will need to show that n = 1.
I will refer to the formula as fn as it changes depending on the value of n. This means fn is equal to the number of swaps needed. In my previous example 2 of each bun were used and one swap was required. I will now show this with the new lettering.
f(n) = 0.5k2 – 0.5k
f(n) = 0.5 x 22 – 0.5 x 2
f(n) = 2 – 1
f(n) = 1
This gives the same result as the previous example, showing that the formula works when n = k. To fully prove my formula works with the induction theory I will now need to show that the formula works when n = k+1
If f(n) = 0.5(k+1)2 – 0.5(k+1) is true then when k = 2, according to the table and formula, (fn) should equal 3.
f(n) = 0.5(k+1)2 – 0.5(k+1)
f(n) = 0.5(2+1)2 – 0.5(2+1)
f(n) = 0.5 x 32 – 0.5 x 3
f(n) = 4.5 – 1.5
f(n) = 3
Furthering the investigation
I am now going to investigate further into these patterns. I have decided to see how the pattern changes as the number of different types of buns is changed. I have made a table to show how many switches are needed for 3 types of bun.
The formula I have found for this sequence, using the same method as before, is
1.5n2 – 1.5n
I have also made a table of how many switches are needed to sort 4 different types of bun.
The formula I have found for this sequence, using the same method as before, is
3n2 – 3n.
Finally I have made a table of how many switches are needed to sort 5 different types of bun.
The formula I have found for this sequence, using the same method as before, is
5n2 – 5n.
With this set of formulas I now intend to work out a master formula to work out formulas for the different numbers of buns of different types.
The sequence of numbers used to make up the formulas is:
0.5 1.5 3 5
0.5 1.5 2
0.5 0.5
This is also a quadratic sequence. I have used the same formula as before to work out the master formula. It comes to N = 0.25n2 – 0.25n (N being the number which is then inserted into the formula for working out how many switches are required). Nn2 – Nn.