# Explanation

Ok, this is what you get - or would have got had you done so - by typing in the sequences "dixon" and "ions". Let me explain right at the start our scoring scheme. The alignment of identical letters gives us a score of +1; the alignment of different letters is punished with a score of -1; and the alignment of a letter and a gap is punished with a score of -2.

Underneath the "DIXON" row is a row of boxes with single numbers in their lower righthand corners, running from 0 to -10. Each one corresponds to a partial alignment, the 0 being empty, the -2 a "D" aligned with a gap, the -4 a "D" with a gap and an "I" with a gap, the -6 the "D" and "I" and "X" all aligned with gaps, etc. That row of numbers involves none of the letters from "IONS".

Likewise the first column of boxes involves none of the letters from the "DIXON" sequences. The -2 is a gap aligned with the "I", the -4 gaps aligned with the "I" and the "O", etc.

That gives us a whole bunch of alignments from which to build - in fact, all the possible starting alignments involving only one of the two sequences. Note that a decision has been made to punish each alignment of a letter and a gap with a score of -2. This is a common gap penalty, but sometimes gap alignments are not penalized if they occur at the start or at the end of the total alignment. In our case these leading and trailing gaps are being penalized.

Ok, from here on out things are less obvious. Each of the rest of the boxes has four numbers in it, with the one in the lower righthand corner corresponding to an optimal score for a partial alignment of all the letters up to and including the letter at the top of the corresponding column and at the start of the corresponding row.

For example, go along the "O" row (the "O" in "IONS") until you get to the "X" column. The big number in the lower right is -2, which is the optimal score for aligning the sequence "DIX" with the sequence "IO". There are three ways we could have got to that point:

• optimally align "DI" with "IO" and add the "X" aligned with a gap (since the optimal score for "DI" aligned with "IO" is also -2, adding the "X"/gap to the alignment -whatever it may be - decreases the score to -4);
• optimally align "DI" with "I" and add the "X" aligned with "O" (since the optimal score for "DI" aligned with "I" is also -1, adding the "X"/"O" to the alignment -whatever it may be - decreases the score to -2);
• or optimally align "DIX" with "I" and add gap aligned with the "O" (since the optimal score for "DIX" aligned with "I" is also -3, adding the gap/"O" to the alignment -whatever it may be - decreases the score to -5).
Those three numbers, -4 and -2 amd -5, are the other three scores appearing in the "O"/"X" box. The best score of the three is -2, so we choose that as the optimal score for aligning "DIX" with "IO".

This same method can be applied to any position as long as we know the optimal scores for the position to the left, above, and diagonally up and to the left. So, starting with the top row and first column of scores corresponding to letters aligned with gaps, we can find an optimal score for the "I"/"D" position, then working to the right do the "I"/"I" position, etc. Eventually we get all the way to the lower righthand corner and discover that the optimal score for aligning "DIXON" with "IONS" is -3. But that doesn't tell us what the alignment or alignments with that score might be.

But we can reconstruct the optimal alignment(s) from this table. To see how this is done, click the purple arrows over on the right when they appear and read what's written in the boxes that appear. When you think you understand it, we'll go to the next page and practice some more.