Combine several functions with restrictions , keeping only one equation

How do I combine these two functions that both have restrictions into a single equation? $$f(x)=|x|\times\frac{\sqrt{x^2-1}}{\sqrt{x^2-1}}$$ and $$g(x)=-|x|\times\frac{\sqrt{1-x^2}}{\sqrt{1-x^2}}$$

• Just see their domains, you can easily define a piecewise function. May 8, 2015 at 16:57
• I am looking for a equation that combines both of them but in a single equation. May 8, 2015 at 16:59

2 Answers

How about the following? $$h(x)=\frac{x^2-1}{|x^2-1|}\cdot|x|\cdot\frac{\sqrt{|x^2-1|}}{\sqrt{|x^2-1|}}$$

If $x^2-1\gt 0$, then $$h(x)=\frac{x^2-1}{x^2-1}\cdot|x|\cdot\frac{\sqrt{x^2-1}}{\sqrt{x^2-1}}=f(x).$$ Note that $f(x)$ is defined only when $x^2-1\gt 0$.

If $x^2-1\lt 0$, then $$h(x)=\frac{x^2-1}{-(x^2-1)}\cdot|x|\cdot\frac{\sqrt{1-x^2}}{\sqrt{1-x^2}}=g(x).$$ Note that $g(x)$ is defined only when $x^2-1\lt 0$.

Added : As a user Mann points out, $$\frac{x^2-1}{|x^2-1|}\cdot|x|$$ should work.

• I think only $\frac{x^2-1}{|x^2-1|}*|x|$ does the work. May 8, 2015 at 17:09
• desmos.com/calculator/mrtsvvoppq May 8, 2015 at 17:22
• @Mann: Ah, you mean that I don't need $\frac{\sqrt{x^2-1}}{\sqrt{x^2-1}}$ part. I think you are right. Thank you for pointing it out. May 8, 2015 at 17:31
• Is there a way to combine 4+ different functions, also in this fashion? May 8, 2015 at 19:25
• @IonLee: Well, it depends. Can you give a concrete example? (I think if you have another question, it's better for you to ask it as a new question :) May 8, 2015 at 19:28

What about $$h(x)= \begin{cases} g(x) & \textrm{for }|x|<1 \\ 0 & \textrm{for }|x|=1 \\ f(x) & \textrm{for }|x|>1\\ \end{cases}$$ assuming you want the function to be zero if $x=\pm 1$. (If you don't want that, omit the second case.)