Question: 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.

Answer: 
call $Q= x f(x) $, then our integral is:

$$ \int \frac{Q}{\int f(x) dx} dx $$

Now integrating by parts:

$$ \frac{ \int Q dx}{\int f(x) dx} +\int \frac{\int Q dx}{ ( \int f(x) dx)^2} f(x) dx$$

For the above to be equal to, $ \frac{ \int x f(x) dx}{\int f(x) dx} i.e: \frac{\int Q dx}{\int f(x) dx}$,

$$ \int \frac{ \int Q dx}{ (\int f(x) dx )^2} f(x) dx= 0$$

So, the equality you wrote is only true for functions $f(x)$ which satisfy above criteria.
This is a typical abuse of notation.

Unless we have bounds on an integral, like $\int\_a^b$, the integral $\int f(x)dx$ stands for a primitive function of $f$.
However, according to the argument of your professor he/she really means an integral with bounds.