A scoring scheme gives matches, mismatches, and gaps numeric weights; the global alignment matrix maximises the total.

highlighted = computed this step

A scoring scheme turns choices into numbers

A match adds +1, a mismatch adds −1, and a gap adds −2. The best alignment is the one with the largest total under that scheme.

match=+1, mismatch=1, gap=2\text{match}=+1,\ \text{mismatch}=−1,\ \text{gap}=−2

Global alignment maximises total score

The global alignment matrix compares every prefix of the row sequence with every prefix of the column sequence. Each cell keeps the best total score that can reach it.

cell=max(diag,up,left)\text{cell}=\max(\text{diag},\text{up},\text{left})
Global alignment matrixNeedleman-Wunsch scores every prefix pair and keeps the best total.GCAGCGCATGC0-2-4-6-8-10-21-1-3-5-7-4-120-2-4-6-3031-1-8-5-2120-10-7-4-121-12-9-6-303

The best score is the bottom-right cell

For this pair, the bottom-right cell is 3. That is the best end-to-end alignment score under the scoring scheme.

best global score=3\text{best global score}=3
Global alignment matrixNeedleman-Wunsch scores every prefix pair and keeps the best total.GCAGCGCATGC0-2-4-6-8-10-21-1-3-5-7-4-120-2-4-6-3031-1-8-5-2120-10-7-4-121-12-9-6-303