By passing two extra arguments to diag(), you can specify the dimensions of the output. Create a 20-by-21 matrix with ones on the main diagonal and call this matrix identity_20_by_21. Now add a row of zeros above this to create a 21-by-21 square matrix, where the ones are offset a row below the main diagonal. Call this second matrix below_the_diagonal.

Create another matrix above_the_diagonal with the ones offset one up from the diagonal. It may be convenient to first create a 21-by-20 matrix with ones on the main diagonal.

Add the matrices below_the_diagonal and above_the_diagonal together and add to this a diagonal matrix with the sequence 10 over 0 to 10 (this diagonal matrix is made in a similar way as the matrix eleven before). The result of the sum of these three matrices is a so-called Wilkinson matrix1 and should be called wilkinson_21.

The eigen() function calculates eigenvalues and eigenvectors of a matrix. Calculate the eigenvalues of wilkinson_21 and notice their pattern (no need to store these eigenvalues in a separate object, but see the help page of the eigen() function for how to extract only the eigenvalues).

(from: Cotton, 2013, Learning R, O’Reilly)