<s>[INST] Function expansion help I want to write a function,  $f(k,a,b)$, I made, in terms of combinations of the fractional part function, $$ j\left\{\frac{c \ }{d}k\right\},$$ where $c,d,$ and $j$ are any integers.
The function is as follows:  $f(k,a,b)=1$ if $k\equiv b$ mod a
and $f(k,a,b)=0$, if it is not
I need a general method for finding the expansion of this function in terms of the fractional part function for any given coprime integers $a,b$.
An example of one is $$ f(k,6,1)= -\{k/6 \}+\{k/2\}+\{2k/3\} $$
Such that if, $k\equiv 1$ mod 6 , then $f(k,6,1)=1$, if not $f(k,6,1)=0$.
So I need a general method for finding the expansion of $f(k,a,b)$ in terms of the fractional part operator.
 [/INST] Let C be a (m-1)*(m-1) matrix of numbers $\large\ c_{ij}=\left\{\Large\frac{i\cdot j}{m}\right\}$
Let $D=C^{-1}$  
Then
$\large f(k,m,1)=\sum_{i=1}^{m-1}d_{i1}\Large\{\frac{i}{m}\cdot\large k\}$
$\large f(k,m,r)=f(k-r+1,m,1)$  
Example: $\ \ \ \ \ m=6$
$$
C=\frac{1}{6}\cdot\begin{pmatrix}
1 & 2 & 3 & 4 & 5 \\
2 & 4 & 0 & 2 & 4 \\
3 & 0 & 3 & 0 & 3 \\
4 & 2 & 0 & 4 & 2 \\
5 & 4 & 3 & 2 & 1
\end{pmatrix}$$
$$D=C^{-1}=\begin{pmatrix}
-1 & 0 & 1 & 1 & 0 \\
0 & 1 & -1 & -1 & 1 \\
1 & -1 & 0 & -1 & 1 \\
1 & -1 & -1 & 1 & 0 \\
0 & 1 & 1 & 0 & -1
\end{pmatrix}$$
$$\large f(k,6,1)=(-1)\cdot\{\frac{1}{6}\cdot k\}+1\cdot\{\frac{3}{6}\cdot k\}+1\cdot\{\frac{4}{6}\cdot k\}$$
</s>