# Codes and Codewords

I'm sorry for the very dumb question, but I just can't grasp the concept of codes.

If C is an [n, k] linear code, what are n and k exactly? I know k is the dimension of C and that n is the number of tuples of the field where C is a subset of. Is n the dimension of the field? If so, why should it be specified? What does C looks like? What does its code words look like? I've read codewords are just vectors in C, and they are mainly denoted by (a1, a2, ..., an), but what are these a's? From the field?

• One possible confusion here is that "codes" such as you describe have little to do with cryptography or encryption. Rather this is a topic arising from error detection and correction. – hardmath Sep 21 '16 at 17:38
• Where are you reading from? Any book or set of lecture notes on coding theory will give these details. – Morgan Rodgers Sep 30 '16 at 3:03

An $[n,k]$ linear code over some field $F$ is a $k$-dimensional subspace of the vectorspace $F^n$. The codewords are elements of $F^n$, that is they are $n$-tuples of elements of $F$. Thus yes the $a_i$ are from the field.
The $n$ is the length of the code, i.e., the codeword. The $k$ is the dimension of the code, which you can think of the size of the code.
In total there are $|F|^n$ strings of lengths $n$ in $F$ but only $|F|^k$ of those form the code.