I was watching the Michael Penn video about representations when he demonstrated a few matrices that when squared equal the identity (all of them below).

These were mostly easy because I could visualize moving the unit vectors around in my head, but I was wondering if there was a general way to find the "roots of unity" for matrices of arbitrary dimension and of degree (for example, I don't know how to find all the matrices in GL(3) that have order 3). Thank you for reading and have a nice day :)