Question: If $f(t) = 1$ when $0 \leq t < 1$, and $0$ when $1 \leq t < 2$, where $f(t+2) = f(t)$, find the Laplace transform.

I have been at this problem for awhile now and can never get the right answer. The answer in the back of the book is $\displaystyle \frac{\frac{1}{s}}{1+e^{-s}}$. I always just get $\displaystyle \frac{1}{s}$ when I do it.

Answer: 
For a periodic function, $f(t)$ that has period $T$, we have:

$$ \displaystyle \mathcal{L} (f(t)) = \frac{\int\_0^{T} e^{-st} f(t) dt}{1-e^{-sT}}$$

Since we have a piecewise function, we get:

$$ \displaystyle \mathcal{L} (f(t)) = \frac{\int\_0^{1} e^{-st}(1) dt}{1-e^{-2s}} = \frac{-\frac{1}{s} (e^{s}-1)}{1 - e^{-2s}} = \frac{\frac{1}{s}}{1 + e^{-s}}$$

Note: $\displaystyle (1-e^{-2s}) = (1+e^{-s})(1-e^{-s})$.
For the periodic function:

$$\begin{align}\hat{f}(s) &= \sum\_{k=0}^{\infty} \int\_{2 k}^{2 k+1} dt \, e^{-s t}\\ &= \frac{1}{s}\sum\_{k=0}^{\infty} \left[e^{-2 s k} - e^{-(2 k+1) s} \right] \\ &= \frac{1}{s} \left [ \frac{1}{1-e^{-2 s}} - \frac{e^{-s}}{1-e^{-2 s}}\right ]\\ &= \frac{1}{s} \frac{1-e^{-s}}{1-e^{-2 s}} \\ &= \frac{1/s}{1+e^{-s}}\end{align}$$