# Is there a way to determine a set's prime form when given its interval vector?

Typically, we use a pitch-class set's prime form to determine the interval vector. But is there an algorithm that lets us go the other way? In other words, given a set's interval vector, can we reverse engineer what the prime form of that set is (or may be)?

My guess is that it's just a brute-force algorithm to go the other way, but perhaps there's a mathematical method of obtaining the prime form.

One obvious difficulty of this question is the notion of Z-related sets. If there is such an algorithm, can it find all possible sets that have that interval vector?

• That might actually be a better question for cs.SE... either way, you should make it precise what kind of algorithm you mean. “A mathematical method” would include the brute-force search as well. And to make it clear what “efficient” would be, you need to say in what parameter. When fixing the system to 12-ET, then any algorithm is technically speaking O (1)... Mar 29, 2019 at 20:58
• There are only 224 prime forms of pitch-class sets. You could probably list them and their interval vectors in a comment here :-) Mar 30, 2019 at 2:42
• I was writing an answer, but then I found that you can easily look them up on this Wikipedia page: en.wikipedia.org/wiki/List_of_pitch-class_sets Mar 30, 2019 at 4:03
• @YourUncleBob Sorry, I should have been more clear: I'm looking for a method that does not involve just using an outside resource.
– Richard
Mar 30, 2019 at 14:44
• @leftaroundabout it's interesting... to answer it, one probably would need computer science, but to understand the question is music theory... Apr 2, 2019 at 3:34

Well, if you're composing in a cabin in the woods, and there's no wifi or cell-phone coverage, and you forgot to bring along your paper print-out of the Wikipedia page, doing it by hand isn't more difficult than solving a Sudoku™. The biggest problem is that most random interval vectors will not lead to a solution, so you could spend a lot of time finding one that actually works.

These are the numbers of Prime Forms, Interval Vectors and Z-Related pairs per size of Pitch Class Set:

```PCs   PF    IV    ZR

0     1     1*    1*
1     1     1*    1*
2     6     6     0
3    12    12     0
4    29    28     1
5    38    35     3
6    50    35    15
7    38    35     3
8    29    28     1
9    12    12     0
10     6     6     0
11     1     1     0
12     1     1     0
---   ---   ---
224   200    24
```

* The empty Pitch Class set and the set with one Pitch Class and Prime Form (0) have the same Interval Vector, and form a Z-Related pair.

You'll notice the symmetry in these numbers. In fact, every Prime Form and Interval Vector of a set with size N have a corresponding PF and IV of a set with size 12-N. This means that when looking for a set with e.g. 9 Pitch Classes, we can look for the corresponding set with 3 Pitch Classes (which is easier), and then transform it.

Step 1: Number of Pitch Classes in the set:

Each size of Pitch Class set has Interval Vectors whose sum are a fixed number; for a set of size N, the sum of the vectors is 0 + 1 + 2 + ... + N-1.

```PCs size: 0   1   2   3   4   5   6   7   8   9  10  11  12
IV sum:   0   0   1   3   6  10  15  21  28  36  45  55  66
```

An Interval Vector like `<2,4,2,4,2,4>` is not valid, because its sum is 18. The Interval Vector `<5,5,4,5,6,3>` has sum 28, and (potentially) corresponds to a Pitch Class set with size 8.

Also, the first five values in the Interval Vector must not be greater than the set size N and not be less than 2×N − 12, and the sixth value must not be greater than N/2 and not be less than N − 6:

2×N − 12 ≤ v1~5 ≤ N
N − 6 ≤ v6 ≤ N/2

Step 2: Transforming the Interval vector:

When transforming from a set of size N to size 12-N, start by taking the difference between the Interval Vector sums for these sizes; e.g. when given an Interval Vector with sum 28, the set size is 8, the new set size will be 12 - 8 = 4, and the new Interval Vector sum will be 6; so the difference of the sums is 28 - 6 = 22. Now divide that number by 5, and find the quotient and the remainder:

```22 / 5  ->  quotient = 4, remainder = 2
```

Now subtract the quotient from the first five values in the vector, and the remainder from the sixth value, e.g.:

```<5,5,4,5,6,3>  ->  <5-4,5-4,4-4,5-4,6-4,3-2>  ->  <1,1,0,1,2,1>
```

So for set sizes 7 to 12 the transformation is:

```size  IV (size N)      IV (size 12-N)

7    <a,b,c,d,e,f>    <a-2,b-2,c-2,d-2,e-2,f-1>
8    <a,b,c,d,e,f>    <a-4,b-4,c-4,d-4,e-4,f-2>
9    <a,b,c,d,e,f>    <a-6,b-6,c-6,d-6,e-6,f-3>
10    <a,b,c,d,e,f>    <a-8,b-8,c-8,d-8,e-8,f-4>
11    <a,b,c,d,e,f>    <a-10,b-10,c-10,d-10,e-10,f-5>
12    <a,b,c,d,e,f>    <a-12,b-12,c-12,d-12,e-12,f-6>
```

Step 3: Creating a graphic representation:

The easiest way to represent a Pitch Class set on paper is to draw a clock face with numbers from 0 to 11. You can then mark the selected Pitch Classes (e.g. by drawing a circle around them, or using colour) and the Pitch Classes which cannot be used (e.g. by crossing them out). Next to the clock face, write down how many of each interval are still required. E.g. with an Interval Vector with zero intervals of distance 5, we could start off like this: The red circle indicates a Pitch Class that has been chosen, the greyed-out circles indicate Pitch Classes that can no longer be used, and the blue line indicates an axis of symmetry.

Step 4: Start puzzling:

The basic strategy is one of trying every option and backtracking when we find any inconsistencies. The number of options can be reduced by taking symmetry into account, and by choosing in which order to add the intervals. A few strategies are:

• We start with any Pitch Class selected (in the example image I chose 0). This creates a symmetric situation. When we add the second Pitch Class, we only have one option to consider; adding it to the left or right of the first Pitch Class will result in a symmetrical result, which would have the same Prime Form.

• When selecting the second Pitch Class, we can start with any interval, without ever having to backtrack to this choice. Every interval that is present in the Interval Vector has to go somewhere, so every solution will have this interval somewhere (after rotation).

• When no more instances of a certain interval are required, this means that some Pitch Classes can no longer be used. In the example image, the fact that the vector contained no instances of interval 5 meant that the Pitch Classes at distance 5 from the already selected Pitch Class (i.e. 5 and 7, because 0 is already selected) become unusable.

• If an interval is present only once in the Interval Vector, starting with that interval will immediately make some Pitch Classes unusable.

• When you come to a situation where several options are possible, make a copy of the current clock face and required interval count, and try the first option. When this doesn't lead to a solution, or you want to check whether there is a second solution, come back to this point, make another copy, and try the next option.

• Whenever you find an impossible situation, backtrack to the last situation where you had several options, and try the next one.

Step 5: Transforming the Pitch Class set:

If you transformed the Interval Vector in step 2, you have to transform the resulting Pitch Class sets by inverting them. Draw a new clock face and mark all the numbers that are not included in the set.

Step 6: Creating the Prime Form:

Look at the clock face, and find the smallest interval, or the longest run of the smallest interval; this will be the start of the set. If there are several options, consider each of them. Now look in both directions to see which direction has the closest next selected Pitch Class. Continue to do this until you find one option that is better than the others. A few examples will make this clearer:

In the first example, there are several intervals of distance 1; the longest run of them is between Pitch Classes 7, 8 and 9. So the Prime Form will start at 7 and go clockwise or start at 9 and go counterclockwise. The clockwise option then has interval 3, whereas the counterclockwise option has interval 2, which is smaller. So the Prime form starts at Pitch Class 9 and goes counterclockwise: (9,8,7,5,1,0), which if we renumber the Pitch Classes from 0 becomes: (0,1,2,4,8,9).

In the second example there are two intervals of distance 2, between 10, 0 and 2. So the Prime Form will start at 10 and go clockwise or start at 2 and go counterclockwise. The clockwise option then has interval 3 (between Pitch Classes 2 and 5), whereas the counterclockwise option has interval 5 (between Pitch Classes 10 and 5), which is larger. So the Prime form starts at Pitch Class 10 and goes clockwise: (10,0,2,5), which if we renumber the Pitch Classes from 0 becomes: (0,2,4,7).

In the third example there are two intervals of distance 2, between 0 and 2 and between 6 and 8; so we have 4 options: starting from 0 and going clockwise, starting from 2 and going counterclockwise, starting from 6 and going clockwise, or starting from 8 and going counterclockwise. However, since the selection is completely symmetrical (with axes going through 1 and 7 and through 10 and 4), any of these will result in the same Prime Form: (0,2,6,8).

Example run-through:

Even when looking for a Pitch Class set of size 6, and looking for a possible second Z-Related solution, you can work through it by hand in a few minutes. Let's look at an example:

```Interval Vector: <2,3,3,2,4,1>
Interval sum: 15
Pitch Class set size: 6
```

We'll start with Pitch Class 0, and add interval 6 first, because there is only one of those required. This means that from now on, whenever a Pitch Class X is added to the set, the Pitch Class X+6, on the opposite side of the clock face, becomes unusable.

We now have a situation with two symmetry axes, which means that whatever interval we add next, we will only have to try one Pitch Class.

We notice that there are three instances of interval 3 required; let's check whether it's possible that none of them is made using the already present Pitch Classes 0 and 6. That would mean that Pitch Classes 3 and 9 become unusable, and another four out of 1, 2, 4, 5, 7, 8, 10 and 11 have to be selected (below, image 1). However, when taking into account that using X discards X+6, no combination of these will give three intervals of size 3 (below, image 2). So we can conclude that any solution includes Pitch Class 3 or 9 (of which we only have to try one, because they are symmetrical) (below, image 3).

Again this situation is symmetrical with an axis through 3 and 9. We now look at the fact that we only need two intervals of distance 1; this means that Pitch Classes 1 and 2 can't be selected at the same time (and neither can 4 and 5). If we selected Pitch Classes 10 and 11 (or the symmetrical case of Pitch Classes 7 and 8), that would give us the two intervals of distance 1, but then the only option for the last Pitch Class would be 8, and set (0,3,6,8,10,11) does not give the right number of each interval (below, image 1). So at least one interval of distance 1 is made by selecting Pitch Class 1 or 2 (we don't have to consider 4 and 5 because of symmetry). So we have two options (below, image 2 and 3):

We see that the second option (above, image 3) requires only one additional interval of distance 1, so one of the two additional Pitch Classes will have to be 10; however, this adds two intervals of distance 4 (between Pitch Classes 10 and 2, and 10 and 6) when only one is still required. So the second option can be discarded.

For the first option (above, image 2), let's again focus on the required number of intervals of distance 5. We need three of them, so the last two Pitch Classes can either be at distance 5 from each other and at distance 5 from an already present Pitch Class (the only option for this is selecting Pitch Class 5 and 10) (below, image 1), or they are not at distance 5 from each other, and one of them is at distance 5 from two already selected Pitch Classes (this would mean selecting Pitch Class 8 and any of the four left over) (below, image 2).

The first of these options is indeed a valid solution. The second option gives us four options for the sixth Pitch Class. Adding Pitch Class 4 does not add an interval of distance 5. Adding Pitch Class 5 adds the right intervals, so it is another solution (below, image 1). Adding Pitch Class 10 does not add an interval of distance 1. Adding Pitch Class 11 adds the right intervals, so it is another solution (below, image 2). So we seem to have two additional solutions:

When we create the Prime Form of these three solutions by rotating and/or mirroring them, we find that the first two are identical:

So we end up with two Pitch Class sets with these Prime Forms:

```Interval Vector: <2,3,3,2,4,1>
Pitch Class sets (PF): (0,1,3,5,6,8), (0,1,2,4,7,9)
```