If $x$, $y$, are words of length $n$ in a code $C$, $x=x_1 \cdots x_n$, $y=y_1 \cdots y_n$ we define
$$d(x, y)= d(x_1, y_1) + \cdots + d(x_n, y_n)$$
from where
$$\quad d(x_i, y_i)=0 \text{ if } x_i=y_i \quad \text{ and } d(x_i, y_i)=1 \text{ if } x_i \neq y_i$$
So let's review the characteristics that a metric meets.
- My idea to proof for non-negativity is to separate the summands, on the one hand those that cancel out and on the other hand those that remain distinct, i.e.
$$d(x, y)=\sum_{i=1, x_i \neq y_i}^q d(x_i, y_i)+ \sum_{i=1, x_i = y_i}^p d(x_i, y_i)= (1+ \cdots +1) + 0 \geq 0$$
- Lets check out that $d(x, y)=0$ iff $x=y$If$\sum_{i=1}^n d(x_i, y_i)=0$, as $d(x_i, y_i) \geq 0$, $d(x_i, y_i)=0$, thus $x_i=y_i$ and $x=y$The converse is similar
3)For the symmetry I did something similar to side 1), split the sum in two and commute the resulting summands.
Now, for the triangular inequality I have tried to see it by cases, but I don't see it at all clear, any help? I appreciate it