The cohomology ring of an oriented closed $3$-manifold with $\pi_1=\mathbb Z$

You can finish easily using some basic algebraic properties of the cup product: namely, it is bilinear and graded commutative. I encourage you to see how you can finish on your own using these properties before reading the solution hidden below.

First, the cup product is bilinear, so $\alpha\cup n\beta=n(\alpha\cup \beta)$ and so if $n$ were not $\pm1$ then there would be no possible value of $\alpha\cup\beta$. Thus $n=\pm1$, and without loss of generality $n=1$ by changing your generators if necessary.

As for $\alpha\cup\alpha$, since $\alpha$ has degree $1$ and the cup product is graded-commutative, $\alpha\cup\alpha=-\alpha\cup\alpha$ which immediately implies $\alpha\cup\alpha=0$ since $H^2$ is torsion-free.


If you believe that there's a single answer (i.e., given only the information that's it's closed, orientable, connected, and $\pi_1 = \Bbb Z$, you can determine the cohomology ring structure uniquely), then you can use the old trick, and compute the answer using an assumption that can be valid. In particular, you can assume that $M = S^1 \times S^2$.