Two square matrices A and B of the same size do not commute.Prove that AB and BA has the same set of eigenvalues.

I did in the following way:Please check if I am correct.

Consider: det(AB-yI)*det(A) where y represents eigenvalues and

I represents unit matrix

=det[(AB-yI)A]

=det[(AB)A-(yI)A]

=det[A(BA)-A(yI)]

=det(A)*det(BA-yI)

det(A) is not equal to zero,in general.

So,if det(AB-yI)=0,det(BA-yI)=0 also.

hence, conclusion.