Riemann-Stieltjes integral Compute the following Riemann-Stieltjes integral: 
The integral from 0 to 3 of $dg(x)/(sqrt(1 + x^2))$ where $g(x) = |2x - 2| + |3x - 6| - |x - 3|$
What I have tried: 
Using formula: sum of $f(c_i)*(g(x_(i+1)) - g(x-i))$. 
--> $1/\sqrt(2)*(1 - 5) + 1/\sqrt(5)*(1 - 1) = -2\sqrt(2)$
I'm not sure that this is the correct formula to use, but I saw that another person used it on this site solving a similar question.  I'm not sure if my answer is correct or not.  

Redefining the function g as follows 
\begin{align}
g\left( x \right) &= \left| {2x - 2} \right| + \left| {3x - 6} \right| - \left| {x - 3} \right|
\\
&= \left\{ \begin{array}{l}
 2x - 2,\,\,\,\,\,x \ge 1 \\ 
 2 - 2x,\,\,\,\,\,0 < x < 1 \\ 
 \end{array} \right. + \left\{ \begin{array}{l}
 3x - 6,\,\,\,\,\,x \ge 2 \\ 
 6 - 3x,\,\,\,\,\,0 < x < 2 \\ 
 \end{array} \right. - \left\{ \begin{array}{l}
 x - 3,\,\,\,\,\,x \ge 3 \\ 
 3 - x,\,\,\,\,\,0 < x < 3 \\ 
 \end{array} \right.
\\
&= \left\{ \begin{array}{l}
 2x - 2 + 3x - 6 - x + 3,\,\,\,\,\,\,\,x > 3 \\ 
 2x - 2 + 3x - 6 - 3 + x,\,\,\,\,\,\,\,2 < x \le 3 \\ 
 2x - 2 + 6 - 3x - 3 + x,\,\,\,\,\,\,\,1 < x \le 2 \\ 
 2 - 2x + 6 - 3x - 3 + x,\,\,\,\,\,\,\,0 \le x \le 1 \\ 
 \end{array} \right.
\\
&= \left\{ \begin{array}{l}
 4x - 5,\,\,\,\,\,\,\,x > 3 \\ 
 6x - 11,\,\,\,\,\,\,2 < x \le 3 \\ 
 2,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,1 < x \le 2 \\ 
 5 - 4x,\,\,\,\,\,\,\,0 \le x \le 1 \\ 
 \end{array} \right.
\end{align}
then
\begin{align}\int_0^3 {\frac{{dg\left( x \right)}}{{\sqrt {1 + {x^2}} }}}  &= \int_0^1 {\frac{{dg\left( x \right)}}{{\sqrt {1 + {x^2}} }}}  + \int_1^2 {\frac{{dg\left( x \right)}}{{\sqrt {1 + {x^2}} }}}  + \int_2^3 {\frac{{dg\left( x \right)}}{{\sqrt {1 + {x^2}} }}} 
\\
&=\int_0^1 {\frac{{d\left( {5 - 4x} \right)}}{{\sqrt {1 + {x^2}} }}}  + \int_1^2 {\frac{{d\left( 2 \right)}}{{\sqrt {1 + {x^2}} }}}  + \int_2^3 {\frac{{d\left( {6x - 11} \right)}}{{\sqrt {1 + {x^2}} }}} 
\\
&=  - \int_0^1 {\frac{{4dx}}{{\sqrt {1 + {x^2}} }}}  + 0 + \int_2^3 {\frac{{6dx}}{{\sqrt {1 + {x^2}} }}} 
\end{align}
Finally using the substitution $x = \tan u$, then we get the desired result.
