We say that two matrices $A,B$ with complex entries are similar if and only if there exists an invertible complex matrix $P$ so that $A = P^{-1} B P$.
Does $P$ always have to be a complex matrix? I've done so many exercises where you are asked to determine if two matrices are similar and I've never come across a matrix with any complex entries. Is it safe to say that if $A$ and $B$ have real entries, then $P$ will also be real?
If we restrict this even more, say $A$ and $B$ both have only coordinates from the rational numbers, then $P$ will also be rational? What about the integers? (no, right? because when you do row operations you will likely start working with fractions) Is there a theorem about this? I've tried looking it up and came across 'rational canonical form' but I'm not sure it's what I'm looking for.