Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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\}$$

share|improve this answer

Recall that the fractional part function $\{x\}$ is defined as the unique real number $r$ with $0\le r<1$ such that $x-r$ is an integer. Recall also that the floor function $\lfloor x\rfloor$ is the unique integer $m$ such that $m\le x<m+1$. Finally, recall that these two functions are related by the identity $x=\lfloor x\rfloor+\{x\}$.

If $a=0$, then your condition for $f(k)$ to be $1$ is $k=0n+b=b$, so we may write:

$$f(k)=\left\lfloor\frac{1}{1+|k-b|}\right\rfloor=\frac{1}{1+|k-b|}-\left\{\frac{1}{1+|k-b|}\right\}.$$

This works because for all $k$, $|k-b|\ge 0$, and $|k-b|=0$ exactly when $k=b$. Thus whenever $k\ne b$, $1+|k-b|>1$ and $0<\frac{1}{1+|k-b|}<1$, so $\left\lfloor\frac{1}{1+|k-b|}\right\rfloor=0$, and if $k=b$, then $1+|k-b|=1$ and $\frac{1}{1+|k-b|}=1$, so $\left\lfloor\frac{1}{1+|k-b|}\right\rfloor=1$.

Otherwise, the condiation for $f(k)$ to be $1$ is $k=an+b$, which is equivalent to $k-b=an$ or $\frac{k-b}{a}=n$. That is, $f(k)=1$ precisely when $\frac{k-b}{a}$ is an integer. Therefore we may write:

$$f(k)=1-\left(\left\{\frac{k-b}{a}\right\}+\left\{-\frac{k-b}{a}\right\}\right).$$

This works because for all $x$, if $\{x\}>0$, then $0\le 1-\{x\}<1$ and $-x-(1-\{x\})=-x+\{x\}-1=-(x-\{x\})-1=-\lfloor x\rfloor-1$, which is an integer, so we must have $\{-x\}=1-\{x\}$ and thus $\{x\}+\{-x\}=1$. On the other hand, if $\{x\}=0$, then $x$ is an integer, so $-x$ is also an integer and we must have $\{-x\}=0$, so $\{x\}+\{-x\}=0$. Therefore $\{x\}+\{-x\}$ is $0$ if $x$ is an integer and $1$ otherwise, so $1-\left(\{x\}+\{-x\}\right)$ is $1$ if $x$ is an integer and $0$ otherwise. We may then substitute $\frac{k-b}{a}$ for $x$ and get the desired function.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.