How can we simplify this integral? $\int{x\frac{f(x)}{\int f(x) dx} dx}$

calculusintegration

In a machine learning lecture, we encountered the following integral that we needed to solve to calculate the mean of some random variable $x$:

\begin{equation*}
\int{x\frac{f(x)}{\int f(x) dx} dx}
\end{equation*}

Without really explaining, the professor just simplified it to this:

\begin{equation*}
\frac{\int x f(x) dx}{\int f(x) dx}
\end{equation*}

I'm not sure how that works. Since the integration is without limits, then the result is a function not a constant, right? It can't be factored out as if it were a constant. Am I missing something? Does integrating on the same variable twice have any special properties that are relevant here?

I'm sorry if the question is lacking in details, if there's anything I can edit to make it clearer, please let me know.

Edit: The problem is solved. The simplification is because the denominator is a definite integral and I didn't understand that at first. Since the result of a definite is just a constant, it can be factored outside the integral.

Best Answer

It should read$$\int x\frac{f(x)}{\int_a^bf(y)dy}dx=\frac{\int xf(x)dx}{\int_a^bf(y)dy},$$where the $x$-integral may or may not be definite (though in this context it would be).

Related Question