Integration with $d($"some function"$)$ instead of $d($"some variable"$)$. $$\int x\,d(x^2)=\;?$$
I am confused with this. Usually we have $d($"some variable"$)$, not $d($"some function"$)$.
My attempt is the following:
$$\int x\,d(x^2)=\int \sqrt{x^2}\,d(x^2)=\frac{(x^2)^{3/2}}{3/2}=\frac{2}{3}x^3.$$
But I am worried because $\sqrt{x^2}=|x|\neq x$ in general.
 A: One can write
$$
\int x\,d(x^2) = \int x\Big( 2x\,dx\Big)=\cdots
$$
etc.
However, the notation
$$
\int_a^b f(x)\,dg(x) \tag 1
$$
is sometimes also taken to mean the Riemann–Stieltjes integral of $f$ with respect to $g$ on the interval $a\le x\le b$.  That is defined as the limit as the mesh of the partition approaches $0$, of
$$
\sum_i f(x_i^\ast)\,\Delta g(x)_i = \sum_i f(x_i^\ast)(g(x_{i+1}-g(x_i))
$$
(where $x_i^\ast$ is some point in $[x_i,x_{i+1}]$).
This integral is the same as
$$
\int_a^b f(x)g'(x)\,dx \tag 2
$$
PROVIDED $g'$ exists everywhere in the interval, and I think one can get by with something weaker than "everyhwere" in some cases.  But the Riemann–Stieltjes integral is defined even in cases where $g'$ fails to exist in many places and where the $(1)$ is not equal to $(2)$.  An example is the case where $g$ is the Cantor function.  That function is everywhere continuous and its derivative is zero almost everywhere, Riemann–Stieltjes integral $\displaystyle\int_0^1 1\,dg(x)$ is equal to $1$.
If $f$ is some function of a random variable (capital) $X$ whose cumulative probability distribution function is $g$, then the expected value $\operatorname{E}(f(X))$ is
$$
\int_{-\infty}^\infty f(x)\,dg(x)
$$
regardless of whether the distribution is discrete or continuous or a mixture of the two or none of the above, and "none of the above" is exemplified by the Cantor distribution.
The Riemann–Stieltjes integral is defined only if the total variation of the function $g$, sometimes called the "integrator", is finite, and also only if $f$ and $g$ have no common points of discontinuity.
A: Usually, $\int d(f(x))=\int f'(x) dx=f(x)$ since $df(x)=f'(x)dx$. Your work isn't wrong for when $x>0$, and you would just split it up if the region of integration included both positive and negative $x$ values.
A simpler way to look at it is that $\int x d(x^2)=\int 2x^2 dx =2x^3/3$ (as long as $x\geq0$).
A: I think we can do this for $x<0$:
\begin{align}
& \text{ if } x<0 \text{ then } |x|=-x \text{ so } -|x|=x \\
&\text{ or } - (x^2)^\frac{1}{2} =x \\
&\int x \, d(x^2)=\int - (x^2)^\frac{1}{2} \, d(x^2) \\
&\text{ someone correct me If I'm wrong }\end{align}
