What 1 variable equation would equal 0 if `x = 0` and 1 if `x != 0`.

Asked on by mike35h

1 Answer | Add Yours

txmedteach's profile pic

txmedteach | High School Teacher | (Level 3) Associate Educator

Posted on

The tough part to this question is that you are asking for a single-variable equation. However, this does not preclude us from using piecewise functions. In fact, based on the problem having a discontinuity, which you will learn all about in calculus, the only way we can express this function mathematically is through the use of a piecewise function.

A piecewise function takes the form:

`f(x) ={(f_1(x) if x in A),(f_2(x) if x in B):}`

Here, A and B are two parts of the domain. In our case, A will be all real numbers that are not zero, and B will only contain zero. Our function will then look like:

`f(x) = {(f_1(x) if x != 0), (f_2(x) if x = 0):}`

Now, we can finish off the problem. Let's just let `f_1(x)` `be 1 and f_2(x)` be 0:

`f(x) = {(1 if x != 0),(0 if x = 0):}`

This solution is a function of one variable that satisfies the problem.

Watch out! A way you might miss this problem is if you try to do this without using a piecewise function. The best example I can think of is the following function:

`f(x) = x/x`

Here, notice that the function is defined and equal to 1 for every `x != 0` . At `x = 0` , the function is undefined because you can never divide by 0! So, you cannot say `f(0) = 0` unless you use the piecewise function above, which is equivalent to the following function:

`f(x) = {(x/x if x != 0),(0 if x = 0):}`

I hope this helps!


We’ve answered 319,844 questions. We can answer yours, too.

Ask a question