# If $a \equiv b \pmod n$ and $c+d = n$, does $ca+bd \equiv 0 \pmod n$?

I am trying to prove a different equation and am able to if the following is true, but I am not exactly sure if it is true.

If $$a\equiv b \pmod{9}$$ and $$c+d = 9$$, is $$ca+bd \equiv 0 \pmod{9}$$ a true statement?

I have tried various examples, like

$$a = 29$$, $$b = 2$$, $$c = 2$$, and $$d = 7$$

$$a = 13$$, $$b = 4$$, $$c = 4$$, and $$d = 5$$

and more.

If anyone has a counterexample, please let me know! Otherwise, if this is true, then can someone please explain why? Thanks!

• Use $a=b+9k$ in $ca+bd$ Jul 15 '19 at 0:41
• Hint: eliminate $\,a\,$ & $\,c\,$ and apply congruence sum & product rules - see my answer. Jul 15 '19 at 1:04

If $$a\equiv b\pmod n$$, then this is just $$a(c+d) \equiv an\equiv 0\pmod n$$

$$a\equiv b\pmod{9}$$ and $$c+d=9$$ implies $$a-b\equiv 0\pmod{9}$$ and $$d\equiv -c \pmod{9}$$ ,respectively. So

$$ca+bd\equiv ca-cb\equiv c(a-b)\equiv c\cdot 0\equiv 0 \pmod{9}.$$

\begin{align}&\ \ \ \ \ \color{#c00}a\ \equiv\,\ \color{#c00}b\\ &\ \ \ \ \ \color{#0a0}c\ \equiv \color{#0a0}{-d}_{\phantom{|}}\\ \hline {\Longrightarrow}\ \ &\ \ \ \color{#0a0}c\ \color{#c00}a\,+\,d\,b\\[.2em] {\equiv}\ \ \ & \color{#0a0}{-d}\,\color{#c00}b\,+\,d\,b\,\equiv\, 0\end{align}\qquad

• We eliminated $\,a\,$ & $\,c\,$ using the Congruence Sum & Product Rules $\ \$ Jul 15 '19 at 1:00
• Do you manually insert the code like \color{#c00} when needed or do you have a tool for coloring conveniently?
– user9464
Jul 25 '19 at 0:03
• @Jack Sometimes I use tools (AHK,Emacs,etc) sometimes by hand (depends on the device). Jul 25 '19 at 1:45

Just to list another approach: $$ac+bd = a\underbrace{(c+d)}_{\text{multiple of 9}} + \underbrace{(b-a)}_{\text{multiple of 9}}d,$$ (this is an equal sign, not a congruent sign) so the left-hand side must be a multiple of $$9$$, too.