Hey, For my discrete mathematics course, they have the theorem "Let R be a relation on a set A. There is a path of length n, where n is a positive integer, from a to be if and only if (a,b) is an element of R^n.

I have a relation, R, {(a,b) (a,c) (a,e) (b,a) (b,c) (c,a) (c,b) (d,a) (e,d) }

which I represented in a matrix:

01101

10100

11000

10000

00010

And I got it correct for a path of length 2 by squaring it and getting

11110

11101

11101

01101

10000

But I am confused as to how to get length 3. I can't figure out how to cube a matrix since (AA)A isn't the same as A(AA) for matrix A.

Can anyone help me out here? I have to do paths of length 2, 3, 5, 7, 9