solve modular arithmetic equation

122 Views Asked by At

How do I solve this equation

$L = D + [D:4]$

  • $L$ is a known integer obtained previously;
  • $D$ is an integer;
  • $[D:4]$ is the quotient part of ($D/4$.)

At first glance, I did not know how to solve this equation as I have never seen this type in my calculus studies. After searching online I found that this is modular arithmetic for two reasons:

  1. The original relation is a congruence equation (Zeller's Rule) dealing with cyclical calendar numbers and I understand that modular arithmetic deals with cyclical integers.
  2. $D/4=quotient(D/4)+remainder (D/4)$ and since $D \pmod 4=remainder(D /4)$ that also means we are dealing with modular arithmetic.

    $∴ [D:4]=D/4-D \pmod 4$

    $∴ L=5/4 D-D \pmod 4 ……………….. (1)$


how to go further with eq. (1)?

Although I read the modular arithmetic rules and practiced a little but I wasn’t sure if I was going the right path. I tried to eliminate the $D \pmod 4$ part by multiplying it with its inverse according to the following rule:

Calculate $A \cdot D \pmod 4$ for $A$ values $0$ through $(4-1)$, the modular inverse of $\pmod 4$ is the $A$ value that makes $A \cdot D\equiv 1\pmod 4$ and only the numbers that share no prime factors with $4$ have a modular inverse $\pmod 4$

From this point, I can obtain an inverse (I think) but It makes no sense to me.

Can anyone help please.

2

There are 2 best solutions below

2
On

If $D = 4q + r$, you've already acheived $L = \frac{5D}{4} + r = 5q + \frac{9r}{4} \implies \frac{9r}{4} = L - 5q \in \Bbb N$. Since $\rm{gcd}(9,4) = 1$, $4|r\, \land \, 0 \leq r < 4 \implies r = 0$. So $D = \frac{4L}{5}$, given the restrictions.

0
On

The answer given above is not complete. What's more, it was obtained from a wrong assumption since the equation $L=\frac{5D}{4}=5q+\frac{9r}{4}$ doesn't follow from the problem conditions (and thus $r$ is not necessarily $0$).

So, we have $D=4q + r$, $0 \leqslant r < 4$. Thus $D/4 = q + r/4 \Rightarrow \lfloor D/4 \rfloor = q$, and $\lfloor D/4 \rfloor= q$. Plugging this in the initial equation, we have $$ L = 4q + r + q = D + q = D + \frac{D-r}{4}. $$ From this, we get $D = \frac{4L + r}{5}$, $L \equiv r \pmod{5}$, $0 \leqslant r < 4$.

There's no solution for $L \equiv 4 \pmod{5}$. Indeed, assume that $L = 5k + 4$ for some $k\in\mathbb{Z}$. In the same way as above, we get $D = \frac{4L+4}{5}$ and $\lfloor \frac{D}{4} \rfloor= \frac{5(k+1)}{5} = k+1$. Thus, $$ \begin{aligned} D + \biggl\lfloor \frac{D}{4} \biggr\rfloor &= \frac{4L+4}{5} + (k+1) = \frac{4(L+1)}{5} + (k+1) = \\ &=4(k + 1) + (k+1) = 5k + 5 = L+1 \neq L. \end{aligned} $$

Thus the equation solution is as follows: $D=\frac{4L + r}{5}$ if $L \equiv r \pmod{5}$, $0 \leq r < 4$, and there's no solution if $L \equiv 4 \pmod{5}$.