1. ## function's formula

Hello.

How could I make a description of the function which relate an argument and a value this way:

x y
0 0
1 1
2 2
...
6 6
7 5
8 4
...
12 0
13 1
14 2

etc...

This is obviously periodic function, so I can write that f(x)=f(x+12) but how could I give a comprehensive formula for order of y? Should I write piecewise definition or rather recursive, or...?

Thanks for all help.

2. Hello, yosso!

I don't have a complete solution yet,
. . but I have some ideas . . .

How could I construct a function which relate an argument and a value this way?

. . $\begin{array}{c|ccccccccccccccccc}
x & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & \cdots \\ \hline
y & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 5 & 4 & 3 & 2 & 1 & 0 & 1 & 2 & 3 & \cdots \end{array}$

This is obviously periodic function, so I can write: . $f(x)\:=\:f(x+12)$
but how could I give a comprehensive formula for $\,y$?
Should I write piecewise definition, or recursive, or ... ?

We can describe the first "cycle" with this function:

. . $f(x) \;=\;6-|x-6|$

We can also describe the first cycle with a piecewise function:

. . $f(x) \;=\;\begin{Bmatrix} x & \text{if }0 \le x < 6\;\; \\ 6-x & \text{if }6 < x \le 12 \end{array}$

Either way, we must make it cyclic with a period of 12.

Hmmm . . .

3. That looks like a complete solution to me! It is a "sawtooth" function.

4. If it is a sawtooth function, there should be $x=y$ (or $x=|y|,$)isn't it? So, it is true for arguments from 0 to 6, but it is not true in refference to numbers following last one. Maybe it could be better to define values in connection of multiples of arguments? For $x=4$ there is true, that $y=4$ and for $2x=4$, $4x=4$, $5x=4$ etc.