Defining functions with integrals Is it okay to have a function $f(x)$ defined by
$$f(x)=\int_0^x{x^2-x\,dx}\,?$$
If so, what would $f'(x)$ be?
I've seen many questions like these on my math competitions (they give functions defined by integrals and both the limits of the integral and the integrand contain the same variable, as in the example above) and it seems like they do have a/n (numerical) answer, and they accept the answer as correct, although people are able to dispute why it shouldn't be okay to have such function.
 A: Let $\phi$ be a continuous, real-valued function defined in some neighborhood of $0$. Writing
$$
f(x) = \int_{0}^{x} \phi(x)\, dx
$$
is bad syntax: it uses the single letter $x$ for both


*

*The input value of the function $f$;

*The dummy variable of integration.
Setting $x = 2$, for example, invites the reader to ponder the meaning of
$$
f(2) = \int_{0}^{2} \phi(2)\, d2,
$$
which is almost surely not intended. (The problem is "$d2$".)
Strictly speaking, "no", it is not okay to have a function $f$ defined by
$$
f(x) = \int_{0}^{x} (x^{2} - x)\, dx.
$$

By contrast, equations such as
$$
g(x) = \int_{0}^{x} \phi(t)\, dt,\qquad
h(x) = \int_{0}^{x} (x - t)\phi(t)\, dt,
$$
do properly define functions. Note carefully that in the defintion of $h$, the input value $x$ appears in the integrand but is not the variable of integration.
The fundamental theorem of calculus gives
$$
g'(x) = \phi(x),\qquad
h'(x) = \int_{0}^{x} \phi(t)\, dt = g(x).
$$
The second is an edifying exercise; to give a proof, it may help to write
$$
h(x) = \int_{0}^{x} (x\phi(t) - t\phi(t))\, dt
= x\int_{0}^{x} \phi(t)\, dt - \int_{0}^{x} t\phi(t))\, dt
= xg(x) - \int_{0}^{x} t\phi(t)\, dt.
$$
A: It is just a basic property,
$$I=\int_{0}^{t}f(x)dx$$
Differentiating
$$I'=f(t)$$
$$f(x)=\int_{0}^{x}x^2-xdx$$
Note that t is a variable
Differentiating w.r.t x
$$f'(x)=x^2-x$$
Reasoning is 
$$f(x)=[\frac{x^3}{3}-\frac{x^2}{2}]_{0}^{x}$$
$$f(x)=\frac{x^3}{3}-\frac{x^2}{2}$$
$$f'(x)=x^2-x$$
A: A function like this is OK, but can be simplified due to the fundamental theorem of calculus. If $G(x)$ is the antiderivative of $g(x)$:
$$f(x)=\int_0^xg(x)\,dx=[G(x)]_0^x=G(x)-G(0)$$
$$f'(x)=(G(x))'-(G(0))'=g(x)$$
Similar derivations can be made for domains of integration other than $[0,x]$.
A: The variable of integral $x $ and the upper bound of integral are different. They arent the same. Since we have by integration property that $\int _a^b f (x)dx=\int _a^bf (t)dt $ we can write it that way though some people find it wrong. Also a case is possible where both the limit of integral and the variable are same like for example. $\int_0 ^x x^2f (t)dt $ then both the x are the same as the variable of integral is t and not x and we can pull it out from the integral operator. As for the part of $f'(x) $ we have a well known theorem ie Newton Leibnitz theorem or Fundamental theorem of calculus which says that if $f (x)= \int _{h(x)}^{g (x)}k (t)dt $ then $f'(x)=k (g (x)).g'(x)-k (h (x).h'(x) $
A: Writing $\int_0^x f(x)\,dx$ is the same as $\int_0^x f(t)\,dt$. However, the former is much more ambiguous and should be avoided for sake of clarity. 
This means the derivative would be,
$$ \frac{d}{dx}\left[ \int_0^x (x^2-x)\,dx \right] = \frac{d}{dx}\left[ \int_0^x (t^2-t)\,dt \right] = x^2 - x $$
A: I'm going to say "no, it is not okay".  As you will eventually find out, you can have integrals such as
$$\int_0^x3x^2+y~\mathrm dy$$
Which should evaluate to $3x^3+\frac12x^2$ (feel free to work it out yourself)
Such integrals appear very often in multivariable calculus, and the above integral was probably part of a larger problem:
$$\int_0^1\int_0^x3x^2+y~\mathrm dy~\mathrm dx$$
Particularly, surface integrals tend to be integrals involving multiple variables, often related to one another.  The above example comes from the following integral:
$$\iint_{0<y<x<1}(3x^2+y)~\mathrm dA$$

So when you've come to problems like these, it will become extremely unclear which variables refer to what and what things mean if you don't name your variables properly.  Note that unlike most of the other answers, in the first integral of my answer, the $x$ in the upper bound and the $x$ inside the integral are one and the same!

So overcome your bad habits soon and use your variables correctly, as any assumptions you make about how you can name your variables will one day bite you back!
