# What is the domain of $f^2$ if $f(x)=\sqrt{x+2}$

Now, $$f(x)$$ is defined for all values of $$x$$ for which $$x+2 \geq 0$$
$$x+2 \geq 0 \implies x \geq -2$$

So, $$\mathrm{Domain}(f)=[-2,\infty)$$ which means $$f : [-2,\infty) \longrightarrow \Bbb R$$

$$f^2(x) = \Big (f(x) \Big )^2=(\sqrt{x+2})^2=x+2$$

So, $$f^2$$ is defined for all values of $$x$$, right? So, shouldn't $$f^2:\Bbb R \longrightarrow \Bbb R$$ ?

According to my textbook, $$f^2:[-2,\infty) \longrightarrow \Bbb R$$

But if we take something outside of $$[-2,\infty)$$, for example $$-5$$ and put it in $$f^2(x)$$, we get:
$$f^2(-5) = \Big (f(-5) \Big )^2=(\sqrt{-5+2})^2=(\sqrt {-3})^2=(-3) \in \Bbb R$$

Doesn't this mean that $$f^2$$ is defined for values outside the domain of $$f$$ as well? So, am I right or is the book right? If the book's right, where am I wrong?

Thanks!

• Your book is right. You can define a new function $h(x): \mathbb{R} \to \mathbb{R}$ s.t. $h(x):= x+2$ but $f^{2}(x)=(f(x))^{2} \neq h(x)$ If plug in $-5$ in $h$, then $h(-5) = -3$, but I simply can't plug in $-5$ in $f^{2}$ just because of the way it is defined. – Derpp May 15 '20 at 15:08
• @Derpp I would say, slightly differently, that $f^2(x) = h(x)$ for all $x \ge -2$, but $f^2 \neq h$. – user786879 May 15 '20 at 15:13
• Yes of course, $f^{2}$ and $h$ do agree on their values $\forall x \geq -2$ – Derpp May 15 '20 at 15:17
• As a rule of thumb, the book is right. – Yves Daoust May 15 '20 at 15:19

The textbook is correct. The domain of $$f(x)=\sqrt{x+2}$$ is $$[-2,\infty)$$ which therefore implies that the domain of $$f^2(x)$$ is also $$[-2,\infty)$$.

The new function that you constructed, $$h(x)=x+2$$, is the not the same as $$f^2(x)$$ since the domain of $$h(x)$$ is $$(-\infty,\infty)$$ while the domain of $$f^2(x)$$ is $$[-2,\infty)$$.

• But isn't the domain of a function the set of values for which it is defined. And since $f^2(x)$ is defined for all real numbers, why choose it's domain as the domain of $f$? – Rajdeep Sindhu May 15 '20 at 15:25
• $f^2(x)$ isn't defined for all real numbers as $f^2(x)$ is restricted by the domain of $f(x)$. – Axion004 May 15 '20 at 15:26
• So, if we have $f(x) = P$, where $P$ is some expression in terms of $x$, and $f^n(x) = Q$, where $Q$ is another expression in terms of $x$, and $h(x) = Q$, so $f \neq h$, since $Domain(f^n)$ is the same as the domain of $f$ since $f^n$ is a direct result of the definition of $f$ and $Domain(f) \neq Domain (h)$ which means that $Domain(f^n) \neq Domain(h)$ but the value of $h(y)=f^n(y) \forall y \in Domain(f^n) \cap Domain(h)$ and $Range(f^n) = range(h)$. Am I right? – Rajdeep Sindhu May 15 '20 at 15:35
• Yes, although it would be $h(x)=f^n(x)$ and the two are the same when $n=1$. The domain of $f^n(x)$ would always be restricted by the domain of $f(x)$ (in terms of the square root function, it would always be when the quantity inside the square root is $\ge 0$ assuming that we are working in the real numbers.) – Axion004 May 15 '20 at 15:45
• That clears it. Thanks again! – Rajdeep Sindhu May 15 '20 at 15:46

You have written $$f^2(-5)=(f(-5))^2$$. It is correct, however, look at the inside function of the RHS. It is $$f(-5)$$. Can you define $$f(-5)$$? No. That means $$f^2(-5)$$ is undefined. Similarly $$f^2$$ is undefined for any $$x<-2$$. So, your book is correct.

$$f^2$$ is the square of $$f$$. If $$f$$ is not defined, neither is $$f^2$$.

• This holds true just because $f^2$ is a result of $f$, right? Also, please check out my comment on @Axion004 's answer too... – Rajdeep Sindhu May 15 '20 at 15:39

for example $$-5$$ and put it in $$f^2(x)$$, we get: $$f^2(-5) = \Big (f(-5) \Big )^2=(\sqrt{-5+2})^2 =(\sqrt {-3})^2=(-3) \in \Bbb R$$

Assume you are given a function $$f(x)=\frac{x}{x}$$. What do you think is the domain of this? $$\mathbb{R}$$ (because it reduces to $$f(x)=1$$)? No! Actually the domain is $$\mathbb{R} \setminus \{0\}$$. And similarly the domain of $$f(x)=(\sqrt{x})^2$$ is $$[0,+\infty)$$ not $$\mathbb{R}$$

$$f^n(x)$$ exists only in the domain of $$f(x)$$. This is because the value of $$f(x) \notin R \space \forall \space x \notin D$$, where $$D$$ is the domain. It is only a coincidence that squaring the complex number brings it to the real plane.

Here's a graph for verification. Notice how the domain of $$g(x)$$ is only $$[-2,\infty)$$ and not $$R$$. Thus, your book is correct in this case.

• I suppose you mean that $\forall x\not\in D$? – user12986714 May 15 '20 at 15:14
• Yes indeed. Edited now. – Aniruddha Deb May 15 '20 at 15:15
• So, we have defined the domain of the square of a function as the domain of that function and not as the values for which the function is defined, right? – Rajdeep Sindhu May 15 '20 at 15:26
• @Rajdeep_Sindhu yes – Aniruddha Deb May 15 '20 at 15:32
• @AniruddhaDeb Thanks a lot! – Rajdeep Sindhu May 15 '20 at 15:33