I am studying basics of topology and the task is to prove that gluing $S^1 \times D^2$ with it's copy along $S^1 \times S^1$ results in space homeomorphic to $S^1 \times S^2$. I came up with a following simple proof:
Let $f: S^1 \times S^1 \rightarrow S^1 \times S^1$, $f_1: S^1 \rightarrow S^1$. Then: $$(S^1 \times D^2) \cup_{f} (S^1 \times D^2) = (S^1 \cup_{f_1} S^1) \times (D^2 \cup_{f_1} D^2) \cong S^1 \times S^2$$
Does this proof make sense? What should ideal formal proof look like?
As it stands your proof doesn't really make sense, because you haven't defined $f$ or $f_1$, and as Angina Seng brings up in a comment for some choices of $f$ the quotient space is actually $S^3$. To establish more formally the result you want, prove the following:
Then using this lemma you can see that $S^1\times S^2 \cong (S^1\times D^2)\cup_{id_{S^1}\times id_{S^1}}(S^1\times D^2)$.