I am taking my first Abstract Algebra course. We are using Fraleigh's textbook "Modern Algebra." I have this problem that asks:
Find the center $Z(D_4)$ and the commutator subgroup of $C$ of the group of symmetries of the square $D_4$.
I am trying to figure out how to find the commutator subgroup without computing every single possible word "$aba^{-1}b^{-1}$". That is just so many computations. I do understand how to find the center though looking at the table 8.12. I can travel along the columns and the rows and if $(i,j)\neq (j,i)$ I know that this element is not a member of the center. All this feels so inefficient though. How can I use theory to expedite this process?

All finite groups can be described by a set of generators. These generators are elements that permit every group element to be written as a word using these generators, and conversely every word consisting of generators determines an element of the group. In the case of the dihedral group $D_n$ two generators are sufficient to express any element of the group. In this case one generator is $r$, a rotation of order $n$ and an involution $s$ (e.g. a flip around the x-axis) having th property $s^2 = 1$. The interaction between $r$ and $s$ is described by the relation $srs = r^{-1}$ (which can also be written as $s^jrs^j = r^{(-1)^j}$). This permits us to write every element of the group as $r^is^j$ ($i=0,\ldots,4$ and $j = 0,1$). This permits us to write the calculations for the center and the commutator subgroup for an element "in general".