I am trying to calculate the average value, i expect to be the end result $ \frac{A}2 $( i think so), but i am afraid i mess up with the calculations when i solve it analytically. I would like some help to get the correct result please. I am interested in for the 'slow' version(analytical solution), no shortcut method.
$$ slope\, between\, [0,\frac{T_o}2] = \frac{2A}{T_0} $$
$$ slope\, between\, [\frac{T_o}2,T_0] = -\frac{2A}{T_0} $$
$$ \begin{align} Avg &= \frac{total\,Area}{total\,time}\\ Avg &= \frac1{T_0} \int_0^{T_0}x(t)\,dt \\ &=\frac1{T_0} \Big(\int_0^\frac{T_0}{2}x_1(t)\,dt + \int_\frac{T_0} {2}^{T_0}x_2(t)\,dt\Big) \\ &= \frac1{T_0} \Big(\int_0^\frac{T_0}{2}\frac{2A}{T_0}(t)\,dt - \int_\frac{T_0}{2}^{T_0}\frac{2A}{T_0}(t)\,dt\Big) \\ &=\frac{2A}{T_0}\frac1{T_0} \Big(\int_0^\frac{T_0}{2}(t)\,dt \int_\frac{T_0}{2}^{T_0}(t)\,dt\Big)\\ &= \frac{2A}{T_0^2}\Big(\frac{t^2}{2}\Big\vert_0^{\frac{T_0}2} - \frac{t^2} {2}\Big\vert_{\frac{T_0}2}^{T_0}\Big)\\ &= \frac{2A}{2\cdot T_0^2}\Big(t^2\Big\vert_0^{\frac{T_0}2}- t^2\Big\vert_{\frac{T_0}2}^{T_0}\Big)\\ &= \frac{A}{T_0^2}\Big(\frac{T_0^2}{4} - (T_0^2 - \frac{T_0^2}{4})\Big)\\ &= \frac{A}{T_0^2}\Big(\frac{T_0^2}{4} - \frac{3T_0^2}{4}\Big)\\ &= \frac{A}{T_0^2}\Big( - \frac{2T_0^2}{4}\Big)\\ &= -\frac{A}2, it \,should\,be\,without\, minus\,symbol,\,right? \end{align} $$

Just to summarize what transpired in the comments (and elaborate a little) so this question won't sit in the "unanswered" queue forever:
Your mistake came when you plugged in $-\frac{2A}{T_0}t$ for $x_2(t)$ when you were solving the integral. Instead, we can see from the equation for the point-slope form of a line that $x_2(t)$ should be $-\frac{2A}{T_0}(t-T_0)$, and that leads to the following integral:
$$\frac1{T_0}\left[\int_0^{\frac{T_0}2}\frac{2A}{T_0}t\,dt-\int_{\frac{T_0}2}^{T_0}\frac{2A}{T_0}(t-T_0)\,dt\right]$$
You can factor out a $\frac{2A}{T_0}$, causing the integral to become the slightly simpler
$$\frac{2A}{T_0^2}\left[\int_0^{\frac{T_0}2}t\,dt-\int_{\frac{T_0}2}^{T_0}(t-T_0)\,dt\right]$$
That evaluates to $\frac A2$, so I was wrong in my second comment. Your original guess was correct! (Good thing I typed this out and actually evaluated my own integral!)