# If $f^2$ is Riemann Integrable is $f$ always Riemann Integrable?

Problem: Suppose that $f$ is a bounded, real-valued function on $[a,b]$ such that $f^2\in R$ (i.e. it is Riemann-Integrable). Must it be the case that $f\in R$ ?

Thoughts: I think that this is not necessarily true, but I am having trouble refuting or even proving the above. Of course, the simplest way to prove that it is not necessarily true would be to give an example, but I am unable to think of one! I also have tried using $\phi(y)=\sqrt y$ and composing this with $f^2$ (to try show $f$ is continuous); however, the interval $[a,b]$ may contain negative numbers so I can't utilise $\phi$ in that case.

Question: Does there exist a function $f$ such that $f^2\in R$ but $f$ $\not\in R$ ? Or conversely, if $f^2\in R$ does this always imply $f$ $\in R$ ? (If so, could you provide a way of proving this).

-
I think our three answers mean : looking for non-integrable functions? First try : think of the indicator function of $\mathbb Q$. –  Patrick Da Silva Nov 25 '12 at 18:08
@Patrick: I concur. :-) –  Did Nov 25 '12 at 18:13

Yes, there exists such functions. Think of $$f(x) = \begin{cases} 1 & \text{ if } x \in \mathbb Q \\ -1 & \text{ if } x \notin \mathbb Q. \end{cases}$$ It is well-known that $f$ is not Riemann-integrable over any interval $[a,b]$ (just compute the Riemann lower/upper sums). But $f^2 = 1$ is very integrable. =)

-

$$f=2\cdot\mathbf 1_{[a,b]\cap\mathbb Q}-1$$

-

Hint: Think about the indicator function $f$ of the rational numbers in the interval $[a,b]$, ie the function that takes the value one on $\mathbb{Q}\cap[a,b]$ and 0 else. Can you modify this function to find such a counterexample?

-

for problem no.

beacuse $f(x)=\{ 1 for \quad x\in \mathbb{Q}$, $-1 for \quad x \notin \mathbb{Q} \}$ f^2 is Riemann-Integrable, but f is not Riemann-Integrable.

for question

$f:\mathbb{R}\rightarrow \mathbb{C}$

$f(x)=i\cdot x$, $\qquad$ $f^2 \in \mathbb{R} \quad and \quad f \notin \mathbb{R}$

-
The OP meant $R$ as in $R$ the set of Riemann-integrable functions over $[a,b]$. You misunderstood him. –  Patrick Da Silva Nov 25 '12 at 19:08