Probability of measuring a particle in the ground state: having trouble with the integration
I think your tactics using partial integration from the start is the problem because $\lvert x \rvert$ is not differentiable at $x=0$ so working with its derivative is not quite kosher (and $v' = -1$ is certainly wrong since for $x &lt; 0$ the gradient of $-\lvert x \rvert$ is $1$).

I suggest you go about it step by step:

\begin{align}
  c_1 &amp;= \frac{2 \sqrt{6}}{a^2} \int\limits_{-a/2}^{a/2} \cos \left( \frac{\pi x}{a} \right) \left( \frac{a}{2} - \lvert x \rvert \right) dx \\
      &amp;= \frac{2 \sqrt{6}}{a^2} \biggl( \frac{a}{2} \underbrace{\int\limits_{-a/2}^{a/2} \cos \left( \frac{\pi x}{a} \right) dx}_{ = \, I_{1} } - \underbrace{\int\limits_{-a/2}^{a/2} \lvert x \rvert \cos \left( \frac{\pi x}{a} \right) dx}_{ = \, I_{2} } \biggr)
\end{align}

Now, integral $I_1$ is easy:

\begin{align}
  I_{1} &amp;= \int\limits_{-a/2}^{a/2} \cos \left( \frac{\pi x}{a} \right) dx \\
   &amp;= \left[ \frac{a}{\pi} \sin \left( \frac{\pi x}{a} \right)  \right]_{-a/2}^{a/2} = \frac{a}{\pi} \sin \left( \frac{\pi}{2} \right) + \frac{a}{\pi} \sin \left( \frac{\pi}{2} \right) = \frac{2a}{\pi}
\end{align}

For integral $I_2$ I suggest that you use that 

\begin{equation}
 \lvert x \rvert = \begin{cases} x &amp;  x \geq 0 \\ -x &amp; x \leq 0 \end{cases}
\end{equation}

and split up the integral into two integrals

\begin{align}
  I_{2} &amp;= \int\limits_{-a/2}^{a/2} \lvert x \rvert \cos \left( \frac{\pi x}{a} \right) dx \\
   &amp;= \int\limits_{0}^{a/2} x \cos \left( \frac{\pi x}{a} \right) dx - \int\limits_{-a/2}^{0} x \cos \left( \frac{\pi x}{a} \right) dx
\end{align}

Now use integration by parts with $u'=\cos \left( \frac{\pi x}{a} \right)$ ($\Rightarrow u=\frac{a}{\pi}\sin \left( \frac{\pi x}{a} \right) $) and $v= x$ ($\Rightarrow v'= 1 $) to solve the integral 

\begin{align}
  \int x \cos \left( \frac{\pi x}{a} \right) dx &amp;= \frac{a}{\pi} x \sin \left( \frac{\pi x}{a} \right) - \int \frac{a}{\pi}\sin \left( \frac{\pi x}{a} \right) dx \\
  &amp;= \frac{a}{\pi} x \sin \left( \frac{\pi x}{a} \right) + \frac{a^2}{\pi^2} \cos \left( \frac{\pi x}{a} \right) \ ,
\end{align}

so

\begin{align}
  I_{2} &amp;= \int\limits_{0}^{a/2} x \cos \left( \frac{\pi x}{a} \right) dx - \int\limits_{-a/2}^{0} x \cos \left( \frac{\pi x}{a} \right) dx \\
        &amp;= \left[ \frac{a}{\pi} x \sin \left( \frac{\pi x}{a} \right) + \frac{a^2}{\pi^2} \cos \left( \frac{\pi x}{a} \right) \right]_{0}^{a/2} - \left[ \frac{a}{\pi} x \sin \left( \frac{\pi x}{a} \right) + \frac{a^2}{\pi^2} \cos \left( \frac{\pi x}{a} \right) \right]_{-a/2}^{0} \\
        &amp;= \frac{a^2}{2 \pi} - \frac{a^2}{\pi^2} - \frac{a^2}{\pi^2} + \frac{a^2}{2 \pi} = \frac{a^2}{\pi} - \frac{2 a^2}{\pi^2}
\end{align}

Plugging this into the equation for $c_1$ gives

\begin{align}
  c_1 &amp;= \frac{2 \sqrt{6}}{a^2} \left( \frac{a}{2} I_{1} - I_{2} \right) \\
      &amp;= \frac{2 \sqrt{6}}{a^2} \left( \frac{a^{2}}{\pi} - \frac{a^2}{\pi} + \frac{2 a^2}{\pi^2} \right) \\
      &amp;= \frac{4 \sqrt{6}}{\pi^2}
\end{align}

and that is indeed what Wolfram Alpha gives you.