Fundamental group of mapping torus?

You can use van Kampen's Theorem. The upshot is that you get a semi-direct product:

$\pi_1M_f\cong\pi_1X\rtimes_{f_*}\mathbb{Z}$.


I will consider the case in which $X$ is connected and that $f$ fixes a point $x_0$.

I think you can use the long exact sequence given by the bundle $\pi\colon M_f \to S^1$ given by considering $S^1=[0,1]/\{0,1\}$ with fiber $X$. So you would have a short exact sequence:

$$1 \to \pi_1(X,x_0)\to \pi_1(M_f,x_0)\to \pi_1(S^1,1)\to 1$$

It is known that a short exact sequence like this implies that $\pi_1(M_f,x_0)$ is a semidirect product of $\pi(X,x_0)$ and $\mathbb Z$ if and only if there exists a section $s\colon \pi_1(S^1,1) \to \pi_1(M_f,x_0)$; i.e, $\pi_{*} \circ s = id$.

It is clear that such a section exists because it is enough to consider the preimage of a generator in $\pi_1(S^1,1)$.

Also to see how $\pi_1(S^1,1)$ acts on $\pi_1(X,x_0)$ consider $[\gamma]\in \pi_1(X,x_0)$ and consider $s(t) = [x_0,t]\in M_f$ , clearly $[s] \in \pi_1(M_f,x_0)$ so it is enough to consider $s\vee\gamma\vee s^{-1}$ and see that it is homotopic to $f(\gamma)$ in $M_f$, where $\vee$ means yuxtaposition of paths.

We have the homotopy: $ H(t,s) = [\overline H(t,s)] $ where $\overline H(t,s)$ is defined on $X\times [0,1]$ and $[\ ]$ means taking the quotient.

Lets define $\overline H(t,s)$ $$ \overline{H}(t,s)= \begin{cases} (x_0,3ts), & t\in[0,\frac13]\\ (f\circ\gamma(3t-1),s), & t\in[\frac13,\frac23]\\ (x_0,3(1-t)s), & t\in[\frac23,1] \end{cases} $$

We can see that $H_0\cong f\circ \gamma$ and $H_1 \cong s\vee \gamma \vee s^{-1}$ So it is clear that $s\vee \gamma \vee s^{-1}$ is homotopic to $f\circ \gamma$ so we have that $\pi(M_f) \cong \pi_1(X) \rtimes_{f_*} \mathbb Z$