Why are $X \sim U(-1,1)$ and $Y=X^2$ dependent? Suppose we have two continuous random variables $X \sim U(-1,1)$ and $Y=X^2$. I don't understand why they are dependent.
$$E[X] = 0$$
$$E[Y] = \int_{-1}^{1} x^2  dx = 2/3$$
$$E[XY] = \int_{-1}^{1} x^3 dx = 0$$
They are independent to me because $E[XY]=E[X]E[Y]$, so why they are dependent?

Since $Y = X^2$, $[-1/2 \leq X \leq 0] \cap [Y > 1/4] = \varnothing$, hence $P[-1/2 \leq X \leq 0, Y > 1/4] = 0$.  On the other hand, $P[-1/2 \leq X \leq 0] = 1/4 > 0, P[Y > 1/4] = 1/2 > 0$.  Hence the independence defining relation $P(A \cap B) = P(A)P(B)$ for all  $A \in \sigma(X), B \in \sigma(Y)$ fails to hold for $A = [-1/2 \leq X \leq 0]$ and $B = [Y > 1/4]$, i.e., $X$ and $Y$ are not independent.
Above is a formal proof.  Intuitively, since $Y$ is a deterministic function of $X$, knowing the value of $X$ means knowing the value of $Y$, hence $Y$ and $X$ of course cannot be independent (the heuristic definition of independence between $X$ and $Y$ requires that observing the information provided by $X$ does not increase the information of $Y$).
It is worth emphasizing that $E[XY] = E[X]E[Y]$ is a necessary condition, rather than a sufficient condition for the independence of $X$ and $Y$.  If you really want to express the independence of $X$ and $Y$ in terms of expectations, it should be stated as

$X$ and $Y$ are independent $\iff$ $E[f(X)g(Y)] = E[f(X)]E[g(Y)]$ for all Borel measurable functions $f$ and $g$.

Evidently, the condition $E[f(X)g(Y)] = E[f(X)]E[g(Y)]$ is much stronger than the condition $E[XY] = E[X]E[Y]$.  The former is a system of infinitely many equations, while the latter is a single equation.
