If A,B,X are quadratic and invertible matrices of the same size express X in terms of A ,B and their inverses. ABAXAB = A^2

I figure that if I first divide both sides with ABA I'd get XAB = (A^2) / ABA

And then it would just be to divide with AB again.

Can you do it like that? Also does matrices work like normal numbers and rules when it comes to exponents?

instead of writing A/A I an just write it like A*A^(-1)?