Solution to Abstract Algebra by Dummit & Foote 3rd edition Chapter 5.1 Exercise 5.1.13
Solution: Note that $Z_4 \times D_8$ is generated by $(x,1)$, $(1,r)$, and $(1,s)$. Hence $Z_4 \ast_\varphi D_8$ is generated by the images of these elements under the natural projection; moreover, the relations satisfied by these also hold in the quotient. We have an additional relation: note that $$(x,1)^2(1,r)^2 = (x^2,r^2) \in Z.$$ Thus $$Z_4 \ast_\varphi D_8 = \langle a,b,c \ |\ a^4 = b^4 = c^2 = 1, a^2 = b^2, ab = ba, ac = ca, bc = cb^3 \rangle.$$ Similarly, $Z_4 \ast_\psi Q_8$ is generated by the natural images of $(x,1)$, $(1,i)$, and $(1,j)$, and we have an additional relation because $$(x,1)^2(1,i)^2 = (x^2,-1) \in Z.$$ Thus $$Z_4 \ast_\psi Q_8 = \langle a,b,c \ |\ a^4 = b^4 = c^4 = 1, a^2 = b^2 = c^2, ab = ba, ac = ca, bc = cb^3 \rangle.$$