# [SOLVED]Piecewise function questions

#### paulmdrdo

##### Active member
given function U(x)

U(x) = { 0, if x<0
{1, if x>=0

define the fuction piecewise and graph.
* U(x) - U(x-1)

how to solve this? please explain! thanks!

#### MarkFL

Staff member
Re: piecewise function questions

Hello and welcome to MHB, paulmdrdo!

We are given:

$$\displaystyle U(x)=\begin{cases}1 & x<0\\ 0 & x\ge0 \\ \end{cases}$$

I would graph this, then graph $U(x-1)$ beneath it, recogninzing that this is just the original graph shifted 1 unit to the right. Now, subtract the lower graph from the upper graph, to create a third graph beneath the other two, representing $g(x)=U(x)-U(x-1)$. From this, you should be able to define $g(x)$ as a piecewise defined function.

Show us what you find.

#### paulmdrdo

##### Active member
Re: piecewise function questions

given function U(x)

U(x) = { 0, if x<0
{1, if x>=0

define the fuction piecewise and graph.
* U(x) - U(x-1)

how to solve this? please explain! thanks!
thank you mark! now i have an idea how to solve this graphically. but is there a way to solve this algebraically?

#### MarkFL

Staff member
Re: piecewise function questions

I think doing this graphically is the easiest method. Otherwise, you will wind up doing essentially the same thing, but without the benefit of a graph to make it more clear.

#### paulmdrdo

##### Active member
Re: piecewise function questions

I think doing this graphically is the easiest method. Otherwise, you will wind up doing essentially the same thing, but without the benefit of a graph to make it more clear.
oh no! please bear with my stupidity. i don't know how to subtract the graph visually. what am I going to subtract, the x-values or the y-values?

#### MarkFL

Staff member
Re: piecewise function questions

You will subtract the function values (the $y$-values) for all real $x$. Can you see what the difference $g(x)$ is outside of $[0,1]$?

#### paulmdrdo

##### Active member
Re: piecewise function questions

You will subtract the function values (the $y$-values) for all real $x$. Can you see what the difference $g(x)$ is outside of $[0,1]$?
mark i tried subtracting the coordinates of the lower graph from the coordinates of upper graph. but i don't know if that's correct. can you give me some examples. thanks!

#### MarkFL

Staff member
What did you find when you did the subtraction?

#### paulmdrdo

##### Active member
Re: piecewise function questions

mark i tried subtracting the coordinates of the lower graph from the coordinates of upper graph. but i don't know if that's correct. can you give me some examples. thanks!
what i did was

(0,1) - (0,0) = (0, 1) - included
(1,1) - (1,1) = (0,0) - not included
and so on...

#### MarkFL

Staff member
This is what I did:

Now, after you are make sure you see what I did, can you use the bottom graph, and write the piecewise function definition for it?

#### paulmdrdo

##### Active member
This is what I did:

View attachment 856

Now, after you are make sure you see what I did, can you use the bottom graph, and write the piecewise function definition for it?
based on the third graph the new function is defined by,

U(x)-U(x-1) = {0, x>=1; 1, 0<=x<1; 0, x<0

but i'm having a hard time subtracting the graph visually.

#### MarkFL

Staff member
First, do you see that on:

$$\displaystyle (-\infty,0)$$ we have: $$\displaystyle g(x)=0$$

$$\displaystyle (0,1)$$ we have: $$\displaystyle g(x)=1$$

$$\displaystyle (1,\infty)$$ we have $$\displaystyle g(x)=0$$

So, I would draw these with open end-points at $x=0,\,1$ Then, to see which to fill in and which to leave open, observe that:

$$\displaystyle U(0)-U(0-1)=1-0=1$$

$$\displaystyle U(1)-U(1-1)=1-1=0$$

Now, this means we may amend our intervals as:

$$\displaystyle (-\infty,0)$$ we have: $$\displaystyle g(x)=0$$

$$\displaystyle [0,1)$$ we have: $$\displaystyle g(x)=1$$

$$\displaystyle [1,\infty)$$ we have $$\displaystyle g(x)=0$$

and so we may write:

$$\displaystyle g(x)=\begin{cases}0 & x<0 \\ 1 & 0\le x<1 \\ 0 & 1\le x \\ \end{cases}$$

#### paulmdrdo

##### Active member
First, do you see that on:

$$\displaystyle (-\infty,0)$$ we have: $$\displaystyle g(x)=0$$

$$\displaystyle (0,1)$$ we have: $$\displaystyle g(x)=1$$

$$\displaystyle (1,\infty)$$ we have $$\displaystyle g(x)=0$$

So, I would draw these with open end-points at $x=0,\,1$ Then, to see which to fill in and which to leave open, observe that:

$$\displaystyle U(0)-U(0-1)=1-0=1$$

$$\displaystyle U(1)-U(1-1)=1-1=0$$

Now, this means we may amend our intervals as:

$$\displaystyle (-\infty,0)$$ we have: $$\displaystyle g(x)=0$$

$$\displaystyle [0,1)$$ we have: $$\displaystyle g(x)=1$$

$$\displaystyle [1,\infty)$$ we have $$\displaystyle g(x)=0$$

and so we may write:

$$\displaystyle g(x)=\begin{cases}0 & x<0 \\ 1 & 0\le x<1 \\ 0 & 1\le x \\ \end{cases}$$
thank you very much mark! you're very generous in answering my questions! i now fully understand it! thanks!