ChineseRemainder
gives the smallest with
that satisfies all the integer congruences
.
gives the smallest with
that satisfies all the integer congruences
.
Details

- If no solution for
exists, ChineseRemainder returns unevaluated.
- If all 0≤ri<mi, then the result satisfies
.
- ChineseRemainder[{r1,r2,…},{m1,m2,…}] gives a solution
with
.
- ChineseRemainder[{r1,r2,…},{m1,m2,…},d] gives a solution
with
.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Applications (3)Sample problems that can be solved with this function
Database encryption and decryption:

https://wolfram.com/xid/0jz78hbdmg1hre-e7h75m


https://wolfram.com/xid/0jz78hbdmg1hre-xfx8df


https://wolfram.com/xid/0jz78hbdmg1hre-p1te3c


https://wolfram.com/xid/0jz78hbdmg1hre-51pfdw

Define a residue number system:

https://wolfram.com/xid/0jz78hbdmg1hre-g55tf1
Numbers and their representation in a residue system:

https://wolfram.com/xid/0jz78hbdmg1hre-bp0cku

https://wolfram.com/xid/0jz78hbdmg1hre-bje3mp


https://wolfram.com/xid/0jz78hbdmg1hre-fd6qp

Multiplying and recovering in the residue system:

https://wolfram.com/xid/0jz78hbdmg1hre-bio07z


https://wolfram.com/xid/0jz78hbdmg1hre-hsbpfe


https://wolfram.com/xid/0jz78hbdmg1hre-cayeha


https://wolfram.com/xid/0jz78hbdmg1hre-i03bzy

Modular computation of a determinant:

https://wolfram.com/xid/0jz78hbdmg1hre-qn5jwv

https://wolfram.com/xid/0jz78hbdmg1hre-cpf5h4


https://wolfram.com/xid/0jz78hbdmg1hre-ennl9a


https://wolfram.com/xid/0jz78hbdmg1hre-3ve85

Shift residue to be symmetric:

https://wolfram.com/xid/0jz78hbdmg1hre-h8q7x6


https://wolfram.com/xid/0jz78hbdmg1hre-bxv3gt

Properties & Relations (1)Properties of the function, and connections to other functions
Solve congruential equations using Reduce or FindInstance:

https://wolfram.com/xid/0jz78hbdmg1hre-fp91qf


https://wolfram.com/xid/0jz78hbdmg1hre-mctkp


https://wolfram.com/xid/0jz78hbdmg1hre-v5ula

Possible Issues (1)Common pitfalls and unexpected behavior
Wolfram Research (2007), ChineseRemainder, Wolfram Language function, https://reference.wolfram.com/language/ref/ChineseRemainder.html (updated 2016).
Text
Wolfram Research (2007), ChineseRemainder, Wolfram Language function, https://reference.wolfram.com/language/ref/ChineseRemainder.html (updated 2016).
Wolfram Research (2007), ChineseRemainder, Wolfram Language function, https://reference.wolfram.com/language/ref/ChineseRemainder.html (updated 2016).
CMS
Wolfram Language. 2007. "ChineseRemainder." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/ChineseRemainder.html.
Wolfram Language. 2007. "ChineseRemainder." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/ChineseRemainder.html.
APA
Wolfram Language. (2007). ChineseRemainder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChineseRemainder.html
Wolfram Language. (2007). ChineseRemainder. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ChineseRemainder.html
BibTeX
@misc{reference.wolfram_2025_chineseremainder, author="Wolfram Research", title="{ChineseRemainder}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/ChineseRemainder.html}", note=[Accessed: 04-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_chineseremainder, organization={Wolfram Research}, title={ChineseRemainder}, year={2016}, url={https://reference.wolfram.com/language/ref/ChineseRemainder.html}, note=[Accessed: 04-April-2025
]}