0
$\begingroup$

We know that $f(x)$ is odd if $-f(x)=f(-x)$. The function is $$f(x)=\begin{cases}2x-1&\text{if $-2<x<0$},\\2x+1&\text{if $0\leq x\leq2$}.\end{cases}$$

Plot of f

(link)

Now I want to know if $f$ is odd, so I query to WA is Piecewise[{{2x-1,-2<x<0},{2x+1,0<=x<=2}}] an odd function?:

Question to WA

I get the answer:

Answer

Now, if we query plot -Piecewise[{{2x-1,-2<x<0},{2x+1,0<=x<=2}}] from -2 to 2 then we see the graph of $-f(x)$:

Sketch of -f(x)

If we query plot Piecewise[{{2(-x)-1,-2<-x<0},{2(-x)+1,0<=-x<=2}}] from -2 to 2 then we obtain $f(-x)$:

Sketch of f(-x)

As the plots are the same, then $-f(x)=f(-x)$, so the function is odd.

However in the first input, WA did not recognize that. Why?

$\endgroup$
  • 3
    $\begingroup$ $f(0)=1{{{}}}$. $\endgroup$ – Lord Shark the Unknown May 19 at 5:26
  • $\begingroup$ @LordSharktheUnknown that is true, thanks. $\endgroup$ – manooooh May 19 at 5:33
1
$\begingroup$

As noted in the comments, $f(0)=1 \ne -f(-0)$. Also, the domain you have specified for $f$ includes $2$ but not $-2$. Mathematica's Piecewise functions have zero as a default value (you can actually see this in your first plot), and so your function has $f(-2)=0$ but $f(2)=5$.

Repeating your query with strict inequalities everywhere gives a function which Wolfram correctly says is odd.

$\endgroup$
  • $\begingroup$ Thanks! Got it. However, this question comes from this other, where the given function includes the $=$ to a part of the piecewise function, so I guess we need to find another expression instead of $2x-1$ to make it odd. $\endgroup$ – manooooh May 19 at 5:45
1
$\begingroup$

The definition of odd function requires first that $-x$ be in the domain of the function whenever $x$ is. In your example, $2$ is in the domain but $-2$ is not, so it couldn't be odd. Also, for any odd function, it follows that $$f(-0)=f(0)=-f(0)\implies f(0)=0.$$ This, however, is not the case with your function. These are the two characteristics that prevent it from being odd.

$\endgroup$
  • $\begingroup$ Thanks! Got it. However, this question comes from this other, where the given function includes the $=$ to a part of the piecewise function, so I guess we need to find another expression instead of $2x-1$ to make it odd. $\endgroup$ – manooooh May 19 at 5:47

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.