Prove by definition that $ \int_a^b fdf = {f^2(b)-f^2(a) \over{2}}$ when $f$ is continuous Let $f :[a,b] \rightarrow \mathbb{R}$ be a continuous function. Prove that $f$ is Riemann Stieltjes integral with respect to itself that is: $f\in RS_a^b(f)$ by definition and $ \int_a^b fdf = {f^2(b)-f^2(a) \over{2}}$
I can't use the Cauchy criterion nor integration by parts to solve this problem:
My definition:
Let $f,g:[a,b]\rightarrow \mathbb{R}$ bounded functions. $f$ is Riemann Stieltjes integrable with respect to $g$ iff there exists a real number $I$ such that $\forall \epsilon > 0$ there exists a partition $P_{\epsilon}$ in $[a,b]$ such that for every other partion $P$ finer than $P_\epsilon$, $|S(P,f,g)-I|<\epsilon$ for every choice of numbers $c_i \in [x_{i-1},x_i]$ where $S(P,f,g)=\sum_{i=1}^nf(c_i)(g(x_i)-g(x_{i-1}))$. In this case we define $\int_a^bfdg = I$
My attempt:
Let $\epsilon > 0$. By uniform continuity of $f$ (because $f$ is continuous on a compact set) there exists $\delta_\epsilon > 0$ such that for every $x,y \in [a,b]$ and $|x-y| < \delta$ then $|f(x)-f(y)|< \epsilon$. We can construct a partition $P_{\delta_\epsilon}$ so that $||P_{\delta_\epsilon}|| < \delta_\epsilon$. Take any other partition $P$ finer thatn $P_{\delta_\epsilon}$ and any choice of numbers $c_i\in [x_{i-1},x_i]$ subinterval of the partition $P$; then:
\begin{align}
|S(P,f,f)-{f^2(b)-f^2(a) \over{2}}| &= \frac{1}{2}|2 \sum_{i=1}^nf(c_i)(f(x_i)-f(x_{i-1}))-f^2(b)+f^2(a)| \\
&= \frac{1}{2}|\sum_{i=1}^nf(c_i)(f(x_i)-f(x_{i-1})) +\sum_{i=1}^nf(c_i)(f(x_i)-f(x_{i-1})) -f^2(b)+f^2(a)| \\ 
&= \frac{1}{2}|\sum_{i=1}^n(f(c_i)-f(x_{i-1})+f(x_{i-1}))(f(x_i)-f(x_{i-1})) +\sum_{i=1}^n(f(c_i)-f(x_i)+f(x_i))(f(x_i)-f(x_{i-1})) -f^2(b)+f^2(a)| \\ 
&=\frac{1}{2}|\sum_{i=1}^n(f(c_i)-f(x_{i-1}))(f(x_i)-f(x_{i-1})) +\sum_{i=1}^n(f(c_i)-f(x_i))(f(x_i)-f(x_{i-1})) +\sum_{i=1}^nf(x_{i-1})(f(x_{i})-f(x_{i-1})) +\sum_{i=1}^nf(x_{i})(f(x_{i})-f(x_{i-1}))-f^2(b)+f^2(a)| \\ 
&=\frac{1}{2}|\sum_{i=1}^n(f(c_i)-f(x_{i-1}))(f(x_i)-f(x_{i-1})) +\sum_{i=1}^n(f(c_i)-f(x_i))(f(x_i)-f(x_{i-1}))| \\ 
&<\frac{1}{2}(\sum_{i=1}^n\epsilon^2 +\sum_{i=1}^n\epsilon^2) \\
&= \epsilon^2(n)
\end{align}
The problem is that the last part depends on $n$ so I can´t conclude that this is less than $\epsilon$ because $n$ depends on the partion $P$. But I don´t know how to solve this part.
I would really appreciate any hints or suggestions with this problem.
 A: If $f$ is of bounded variation, then for any partition $P: a = x_0 < x_1 < \ldots < x_n = b$ we have 
$$\sum_{i=1}^n|f(x_i) - f(x_{i-1})| \leqslant V_a^b(f),$$
where $V_a^b(f)$ Is the total variation.  
Continuing with your proof, it follows that (for all sufficiently fine partitions)
$$\frac{1}{2}\left|\sum_{i=1}^n(f(c_i)-f(x_{i-1}))(f(x_i)-f(x_{i-1})) +\sum_{i=1}^n(f(c_i)-f(x_i))(f(x_i)-f(x_{i-1}))\right| \\ \leqslant \frac{1}{2}\sum_{i=1}^n|f(c_i)-f(x_{i-1})||f(x_i)-f(x_{i-1})+ \frac{1}{2}\sum_{i=1}^n|f(x_i)-f(c_i)||f(x_i)-f(x_{i-1})|\\ \leqslant \epsilon \sum_{i=1}^n|f(x_i)-f(x_{i-1})| \\ \leqslant \epsilon V_a^b(f)$$
This is enough  to prove existence of the integral as $V_a^b(f)$ is a constant and independent of the choice for the partition.
Th question remains as to whether this is true if $f$ is continuous and of unbounded variation. An example of such a function is is $$f(x) =\begin{cases} x^2 \cos(1/x) , & 0 < x \leqslant 1 \\0, & x= 0 \end{cases}$$
Note also that a proof of $\int_a^b f\,df = (f^2(b) - f^2(a))/2$ using integration by parts requires that it first be established that the integral exists -- and again the question arises if this is always true when $f$ has unbounded variation.
