I am graphing a square with the following equation:


enter image description here

However, I need the equation in terms of y. That is, the form y=f(x) as opposed to the current |y|=f(x)

How do you get an equation in terms of y when absolute value is wrapping it. Is there an inverse absolute value function I can apply to both sides of the equation?

My first attempt was to use the old trick: $|n| = \sqrt[2]{n^2}$

But of course that's not a real equation since roots have $±$.

Sure enough when applying that to try to get the equation in terms of y the graph failed to reproduce a square and ended up graphing what looked like a 'w'.

enter image description here

  • 5
    $\begingroup$ This isn't a function, so the only way to do it would be piecewise-ish. $\endgroup$ – Randall Dec 17 '18 at 18:50
  • $\begingroup$ @Randall I wonder if there is a way to do it without going piecewise. I am currently experimenting with converting absolute value to this form $|y| \rightarrow y\cdot sgn(y)$ $\endgroup$ – Albert Renshaw Dec 17 '18 at 18:54
  • 2
    $\begingroup$ But sgn(y) is also piecewise... run into same problem. $\endgroup$ – coffeemath Dec 17 '18 at 18:58
  • 2
    $\begingroup$ @AlbertRenshaw It is not possible. A single $x$ creates two different $y$s (generally), so there is no way to make this function-like. $\endgroup$ – Randall Dec 17 '18 at 19:01
  • 2
    $\begingroup$ Then the answer is no, since you have two branches. That's similar to the equation of a circle $x^2+y^2=1$ $\endgroup$ – Andrei Dec 17 '18 at 19:08

$y = \pm |y| = \pm (1 - |x|)$ for $-1 \le x \le 1$.

That is, there are two cases: $+(1 - |x|)$ which gives you the top half of your square, and $-(1-|x|)$ which gives you the bottom half.

Those inequalities are necessary, because $|y|$ is not allowed to be negative.

  • $\begingroup$ Thanks, I was hoping for something unbounded but this will have to do for now. +1 $\endgroup$ – Albert Renshaw Dec 17 '18 at 19:23
  • $\begingroup$ You cannot do any better, and this still is not of the form $y=f(x)$ that you originally asked for, because that's impossible. The answer here is the best possible, but please do not think it is a function. $\endgroup$ – Randall Dec 17 '18 at 20:43
  • $\begingroup$ @randall you’re getting too caught up on the word “function”. I’m aware function isn’t the correct term, however this answer is sufficient for the use-case I have. I’m leaving the question open for now to see what else others may come up with $\endgroup$ – Albert Renshaw Dec 17 '18 at 21:26
  • $\begingroup$ What do you mean "something unbounded"? The square is bounded! $\endgroup$ – Robert Israel Dec 17 '18 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.