An alignment of two strings is formed by adding gap symbols ($\textrm{-}$) to each string so that the resulting augmented strings have the same length; as a result, symbols from corresponding positions can be superimposed over one another to give the alignment. We require that gap symbols are not aligned with other gap symbols, so that a gap symbol represents the insertion or deletion of the symbol in the opposing string.

A run of contiguous gap symbols in one string is called a gap. Thus, aligning homologous genetic strings allows us to infer substituted symbols (from mismatched symbols) as well as insertions and deletions (from gaps) that have arisen throughout the course of evolution. See the figure below for a sample alignment of protein strings. We see a large gap in the bottom string of the first alignment, implying that the corresponding amino acids in the top string have all been deleted. In a reverse scenario, these symbols are inserted into the bottom string to yield the top string.


Consult the entry on multiple alignment if you would like to read about the case in which we align more than 2 strings simultaneously.