MATH 470 Lecture 2

From Notes
Jump to navigation Jump to search

« previous | Thursday, January 17, 2013 | next »


Fundamental Theorem of Arithmatic

Any can be written as for pairwise distinct primes and


Corollary

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{GCD}(p_1^{a_1} \dots p_k^{a_k}, p_1^{b_1} \dots p_1^{\min{(a_1,b_1)}} \dots p_k^{\min{(a_k,b_k)}}}


Corollary

If with = 1 and


Extended Euclidean Algorithm

Input:
Output: and with

  1. Form matrix
  2. Use elementary column operations (only allowing divisions by ≠ 1) to reduce to
  3. You have your answers , , and

Example

Solve

Rewrite as . Find and such that

Therefore, all of the following are true:


Complexity: Lame's Theorem

Number of column operations needed is ≤ 5 × number of digits in smaller number

Theorem on Congruences

Given any , the congruence has exactly solutions when and no solutions otherwise

Example

has solutions .

How would we have known?

  1. find via Extended Euclidean Algorithm (; )
  2. divide out equation by ()
  3. solve equation above ()
  4. solutions are:


Proof

First note that implies no solutions.

Indeed implies for some .

, so leads to a contradiction.

For example, cannot be solved since is even and is odd.


Let's assume

if Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g \mid \{a,b,n\}} , and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x} is any solution to Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle ax = b \pmod{n}} , so is Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x + i\left(\frac{n}{g}\right)} for any Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle i \in \{0,\ldots,g-1 \}}


Indeed, Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle a \left(x+i\left(\frac{n}{g} \right)\right) \equiv ax + i \left(\frac{a\,n}{g} \right) \equiv b + i\,n \left( \frac{a}{g} \right) \equiv b \pmod{n}}


Moreover, Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \frac{n}{g}, \frac{2n}{g}, \ldots, \frac{(g-1)n}{g}} are clearly distinct mod Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n}

It's enough to consider Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle g = 1}

To conclude, Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle ax \equiv b \pmod{n} \iff a\,x + n\,y = b} has only one solution.

Now suppose if there are two solutions Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (x_1,y_1)} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (x_2,y_2)} , then we get

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} a\,x_1 + n \, y_1 &= b \\ a\,x_2 + n \, y_2 &= b \\ a(x_1 - x_2) + n(y_1 - y_2) = 0 \end{align}}

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{GCD}(a,n) = 1} , so since Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n} divides the RHS, it also divides the LHS

Therefore, Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle n \mid (x_1-x_2) \implies x_1 \equiv x_2 \pmod{n}}

Q.E.D.


CAS Stuff

Maple

> (* Matrices *)
> M := matrix([[a,b,c],[d,e,f],[g,h,i]]);


Sage

sage: # Affine Ciphers == of the form: f(x) = a*x + b (mod 26)
sage: A = AffineCryptosystem(AlphabeticStrings());
sage: P = A.encoding("Hey! How's it going?");
  => HEYHOWSITGOING
sage: a,b = (9,13);
sage: cipher = A.enciphering(a,b,P);
  => YXVYJDTHCPJHAP


Solving Linear Systems

(mod an integer)


Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{cases} 2x + 3y = 1 & \pmod{26} \\ 7x + 14y = 2 & \pmod{26} \end{cases}}

Put into an augmented matrix

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{bmatrix} 2 & 3 & 1 \\ 7 & 14 & 2 \end{bmatrix}}

First operation would be to subtract 7/2 times the first row from the second row... TROUBLE! What's 1/2 mod 26? (undefined)

2 options

  1. Do gaussian elimination without dividing by two (similar to E.E.A.)
  2. Use adjoints


First Option

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{bmatrix} 2 & 3 & 1 \\ 7 & 14 & 2 \end{bmatrix} \rightarrow \begin{bmatrix} 1 & 5 & -1 \\ 0 & -7 & 3 \end{bmatrix}}

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} x + 5y &= -1 \pmod{26} \\ -7y &= 3 \pmod{26} \end{align}}

We can invert -1/7 mod 26:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle -\frac{1}{7} = -15 = 11 \pmod{26}}

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \begin{align} y &= 3 \cdot 11 = 7 \pmod{26} \\ x &= -36 = 16 \pmod{26} \end{align}}

Second Option

Cramer's rule

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (x,y) = \left( \frac{\begin{vmatrix}1&3\\2&14\end{vmatrix}}{\begin{vmatrix}2&3\\7&14\end{vmatrix}}, \frac{\begin{vmatrix}2&1\\7&2\end{vmatrix}}{\begin{vmatrix}2&3\\7&14\end{vmatrix}} \right)}


We only have to invert 7, which is relatively prime to 26, so it is possible.

Theorem

You can solve Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle Ax = b \pmod{n}} for any matrix of integers Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle A} and any Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle k \times 1} vector of integers Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle b} when Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \mathrm{GCD}\left(\left|A\right|,n \right) = 1}