First, we need to turn the keyword into a matrix. Any size matrix can be used, as long as it results in a box (for example, 2x2 or 3x3). For this example we will use a 3x3 matrix. When creating the matrix, use numbers under 26 (representing letters in the english alphabet).
So now we have our matrix key. Now we will try to encrypt a message with the plaintext "retreat now". First, we need to divide the plaintext into groups of three letters (trigraphs), since we are using a 3x3 matrix, and write them in columns (since the plaintext will not go evenly into the columns, we have to use some nulls (x) to make the plaintext the right length).
Now we have to convert the letters into numbers.
Now we start our matrix multiplication. We have to multiply our key by each column of letters in turn. Below is the algebraic way to complete matrix multiplication. After we get our 3 numbers, we need to preform modulo arithmetic (mod 26) to get numbers equivalent to get our ciphertext.
Now we need to preform our first matrix multiplication.
Now onto our second trigraph:
Now our third trigraph:
And finally, the last trigraph:
Now we have all of our encrypted letters. Now we just need to put them all together and create our ciphertext "DPQRQ EVKPQ LR" (we keep the nulls to make the cipher decrypt-able)