weird finding function from the graph 
The graph is on the interval [-3,3], defined on R
This function maintain the pattern on all of R
How to find the $f(x)$?
See how the graph goes parallel at certain intervals. I am thinking adding one more variables to indicate one of the direction. However, I cannot merge the two together.
Any thoughts?
 A: You can use a triangle wave written in terms of sine and arcsine:
$$f\left(x\right)\ =\ \frac{1}{\pi}\arcsin\left(\sin\left(\pi\left(x+\frac{1}{2}\right)\right)\right)+\frac{1}{2}.$$  This gives you the following plot:

A: Using the absolute value function together with the floor function, you can write
$$
f(x)=1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
$$
Verification:

With $f$ as defined above, we get
\begin{align*}
f(x+2)
&=
1-\left|(x+2)-\left(2\left\lfloor\frac{(x+2)+1}{2}\right\rfloor\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left\lfloor\frac{x+1}{2}+1\right\rfloor\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left(\left\lfloor\frac{x+1}{2}\right\rfloor+1\right)\right)\right|
\\[4pt]
&=
1-\left|x+2-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)-2\right|
\\[4pt]
&=
1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
\\[4pt]
&=
f(x)
\\[4pt]
\end{align*}
so $f$ is periodic with period $2$.

It remains to verify that $f$ works correctly on the interval $[-1,1)$.

Thus suppose $f$ is restricted to the interval $[-1,1)$.
\begin{align*}
\text{Then}\;\;&
-1\le x < 1
\\[4pt]
\implies\;&
0\le x+1 < 2
\\[4pt]
\implies\;&
0\le \frac{x+1}{2} < 1
\\[4pt]
\implies\;&
\left\lfloor\frac{x+1}{2}\right\rfloor=0
\\[4pt]
\end{align*}
hence for $-1\le x < 1$ we get
$$
f(x)
=
1-\left|x-\left(2\left\lfloor\frac{x+1}{2}\right\rfloor\right)\right|
=
1-|x|
$$
which matches the graph for the interval $[-1,1)$.
A: You can define the function in part-wise intervals. For example,
$$y=1-x, ~~\text{if}~ x \in [0,1] $$
Similarly, define the function for other intervals.
