I would like to integrate the following:
$$I = \int _0^t d \tau \int _0 ^t d\tau 'e^{-\gamma|\tau-\tau'|} \tag{1}$$
where this integral is defined in the real numbers. In my lecture notes is stated that:
$$\int _0^t d \tau \int _0 ^t d\tau 'e^{-\gamma|\tau-\tau'|} = 2\int _0^t d \tau \int _0 ^\tau d\tau 'e^{-\gamma(\tau-\tau')}=\frac{2}{\gamma}t-\frac{2}{\gamma ^2}\left(1-e^{-\gamma t}\right) \tag{2}$$
however I don't get why the first equality holds true, I don't get why it should be the double.
Anyway: since I didn't get the equality I tried to solve it my own way, like this:
$$\int _0^t d \tau \int _0 ^t d\tau 'e^{-\gamma|\tau-\tau'|}=\int _0^t d \tau \left[\int_0^\tau d\tau ' e^{-\gamma(\tau-\tau')} + \int _\tau ^t d\tau ' e^{\gamma(\tau-\tau')} \right]=\frac{1}{\gamma}\int _0 ^t d \tau \left[-2+e^{-\gamma \tau}+e^{\gamma (\tau -t)}\right]=$$
$$=-\frac{2}{\gamma}t-\frac{2}{\gamma ^2}\left(e^{-\gamma t}-1\right)$$
That is not what I should get according to $(2)$. Indeed I obtained the exact opposite: I am missing a minus sign; however I cannot find it and it's driving me a little crazy... Where did I go wrong? And, bonus question, why the first equality in $(2)$ holds?
Always try to use symmetry. The function $|\tau-\tau'|$ is symmetric about the line $\tau=\tau'$, and so is the region of integration ($0\le\tau,\tau'\le t$). So the integral over the triangle $\{0\le\tau'\le\tau\le t\}$ is equal to the integral over the triangle $\{0\le\tau\le\tau'\le t\}$.
Since you haven't shown the details of your computation, it's difficult to say exactly where you went wrong. I'm guessing that you dropped a negative when you took the antiderivative of $e^{-\gamma\tau'}$.