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(A) is not equal to zero,in general.
So,if det(AB-yI)=0,det(BA-yI)=0 also.
hence, conclusion.