# The Chinrem Function; The Egcd Function; The Gcd Function - HP 49g+ User Manual

Graphing calculator.

## The CHINREM function

CHINREM stands for CHINese REMainder.
The operation coded in this
command solves a system of two congruences using the Chinese Remainder
Theorem.
This command can be used with polynomials, as well as with
integer numbers (function ICHINREM).
The input consists of two vectors
[expression_1, modulo_1] and [expression_2, modulo_2]. The output is a
vector containing [expression_3, modulo_3], where modulo_3 is related to the
product
(modulo_1)⋅(modulo_2).
Example:
CHINREM(['X+1',
'X^2-
1'],['X+1','X^2']) = ['X+1',-(X^4-X^2)]
Statement of the Chinese Remainder Theorem for integers
If m
, m
,...,m
are natural numbers every pair of which are relatively prime,
1
2
r
and a
, a
, ..., a
are any integers, then there is an integer x that
1
2
r
simultaneously satisfies the congruences: x ≡ a
), x ≡ a
(mod m
(mod
1
1
2
), ..., x ≡ a
m
(mod m
). Additionally, if x = a is any solution then all other
2
r
r
⋅m
⋅ ... m
solutions are congruent to a modulo equal to the product m
.
1
2
r

### The EGCD function

EGCD stands for Extended Greatest Common Divisor. Given two polynomials,
A(X) and B(X), function EGCD produces the polynomials C(X), U(X), and V(X),
so that C(X) = U(X)*A(X) + V(X)*B(X). For example, for A(X) = X^2+1, B(X) =
X^2-1, EGCD(A(X),B(X)) = {2, 1, -1}. i.e., 2 = 1*( X^2+1')-1*( X^2-1). Also,
EGCD('X^3-2*X+5','X') = { 5, '-(X^2-2)', 1}, i.e., 5 = – (X^2-2)*X + 1*(X^3-
2*X+5).

### The GCD function

The function GCD (Greatest Common Denominator) can be used to obtain the
greatest common denominator of two polynomials or of two lists of
polynomials of the same length. The two polynomials or lists of polynomials
will be placed in stack levels 2 and 1 before using GCD. The results will be a
polynomial or a list representing the greatest common denominator of the two
polynomials or of each list of polynomials. Examples, in RPN mode, follow
(calculator set to Exact mode):
'X^3-1'`'X^2-1'`GCD Results in: 'X-1'
{'X^2+2*X+1','X^3+X^2'} `
{'X^3+1','X^2+1'} `
GCD results in
{'X+1' 1}
Page 5-19