# Old Stuff 1 – Mystic Roses

When I was at high school I used to draw these patterns in my school diary (take circular protractor, make a point at every 20 degrees and join every point to every other point). I was frustrated that I could never get them quite right and spent a lot of time trying to recreate one using MS Paint.

At the start of my second year at university I decided to write a program to create these patterns for me. I was pretty pleased with myself! (Yeah yeah, needs anti-aliasing…shhhh!).

[most modern browsers want nothing to do with the applet, link removed]

When I got bored with drawing these at school, I worked out the formula for the relationship between number of points and number of lines. It’s a useful formula to understand, so here’s some maths with words and pictures.

# Maths with words and pictures:

Question: If you draw a bunch of points, then join every point with every other point, how many lines have you drawn?

Answer: Take the number of points, multiply it by itself, subtract the number of points. Divide this result by two.

y = ((x*x) – x)/2 where x = number of points and y = number of lines.

## Explanation

Step 1
A line is drawn from every point to every point.
4 lines * 4 points = 16 lines.
This is the x*x part of the formula.
Step 2

You will notice that a line has been drawn from every point to itself. We don’t need these extra lines so we delete them.
(4 lines * 4 points) – 4 lines = 16 – 4 = 12 lines.
This is (x*x) – x

Step 3

We still have extra lines that we don’t need. In fact we have twice as many as we need. Easy answer – divide by 2!
((4 lines *4 points) – 4 lines) / 2 = (16-4) / 2 = 12 / 2 = 6 lines.
((x*x) – x) / 2

We now have one line from every point to every other point.

This equation can be useful for many scenarios. For example, you are arranging a tournament of a 1 vs 1 activity. You have x people entering and you want to know how many matches there will be. The same formula applies – people cannot compete against themselves (subtract x), and Bob versus Jane is the same match-up as Jane versus Bob (divide by two to remove the double-ups).

You can simplify this equation for quick head-maths (or with larger numbers, simplify it to a single multiplication that you can work out quickly with a calculator). You have x. Subtract 1 from x. One of these two numbers is an even number. Divide the even number by 2, then multiply the answer with the other number.

Example:
You have a tournament between 9 people and want to know how many matches there will be.
Nine minus one is eight. Eight is even, so divide it by two is four. Nine times four is thirty-six.
(9 * (9-1))/2
(9 * 8)/2
9 * (8/2)
9 * 4
36

Example 2:
Three more people join your tournament, now there are 12 people! Recalculate!
Twelve minus one is eleven. Twelve is even, twelve over two is six. Six times eleven is sixty-six.
(12 * (12-1))/2
(12 * 11)/2
(12/2) * 11
6 * 11
66

Why this works
y = (x*x – x)/2 contracts to y = (x * (x-1))/2

y = (x * (x-1))/2 is the same as
y = (x/2) * (x-1)
and
y = x * ((x-1)/2)
You are choosing between the last two equations by which is simpler to calculate in your head (dividing an odd number by two and then multiplying is harder).