(a) Multiplying the matrix A by itself,
A2 = [[1 1 2]
[1 0 1]] x [[1 1 2]
[1 0 1]]
= [[1*1 + 1*1 + 2*1, 1*1 + 0*1 + 1*2],
[1*1 + 1*0 + 1*1, 1*0 + 0*0 + 1*0]]
= [[4, 3],
[2, 1]]
(b) i. The (1,3) entry of A2 is the number of walks of length 2 from v1 to v3. So there is 3 such walks.
ii. The (1,1) entry of A2 is the number of walks of length 2 from v1 to v1. So there are 4 such walks.