# New Semi-Prime Factorization and Application in Large RSA Key Attacks
## 3 Background Theory  
This section provides the background theory that forms the mathematical foundations of this research work. Mathematical proofs, along with a summary of the definitions and a theorem with the supporting lemmas that are used for our proposed semi-prime factorization approach, are given below.  
Let us consider the Brahmagupta-Fibonacci identity [14], which expresses the product of two prime sums of two squares as two sums of two squares in two different ways with the following mathematical representation:  
\[p_{1}p_{2}=\Big{(}x_{11}^{2}+x_{12}^{2}\Big{)}\Big{(}x_{21}^{2}+x_{22}^{2} \Big{)}=(x_{11}x_{21})^{2}+(x_{11}x_{22})^{2}+(x_{12}x_{21})^{2}+(x_{12}x_{22} )^{2} \tag{1}\]  
\[p_{1}p_{2}=(x_{11}x_{21}\mp x_{12}x_{22})^{2}+(x_{11}x_{22}\pm x_{12}x_{21})^{2} \tag{2}\][PERSON] [2] provides various sums of four squares for a particular number. Among these, Equation (1) is a special case in the set of possible \(r_{4}(n)\) solutions.  
\[r_{4}(n)=8\underset{d|n}{\sum}(n),\qquad n\text{ is odd}. \tag{3}\]  
Let us consider [PERSON]'s four-square theorem, also known as [PERSON]'s conjecture [49], which states that every natural number can be represented as the sum of four integer squares with the following mathematical representation:  
\[n=\sum_{k=1}^{4}y_{k}^{2}\ \,\ \ y_{k}\text{ are integers such that }\ \ \ n=y_{1}^{2}+y_{2}^{2}+y_{3}^{3}+y_{4}^{2}\]  
According to [PERSON]'s three-square theorem [50], a natural number \(n\) can be represented as the sum of three squares of integers as follows:  
\[n=\sum_{l=1}^{3}z_{l}^{2},\ \ \ z_{l}\text{ are integers }\text{ iff }n\
eq 4^{a}(8b+7)\text{ where }\ \ a,\text{ b are integers}\]  
From [PERSON]'s identity [51], the square of the sum of four squares can be given by the sum of three squares and can be represented as follows:  
\[n^{2}=\left(\sum_{k=1}^{4}y_{k}^{2}\right)^{2}=\sum_{l=1}^{3}z_{l}^{2},\ \ n^{2}=z_{1}^{2}+z_{2}^{2}+z_{3}^{2} \tag{4}\]  
\[n=y_{1}^{2}+y_{2}^{2}+y_{3}^{2}+y_{4}^{2},\ \ z_{1}=y_{1}^{2}+y_{2}^{2}-y_{3}^{2} -y_{4}^{2},\]  
\[z_{2}=2(y_{1}y_{3}+y_{2}y_{4}),\ \ z_{3}=2(y_{1}y_{4}-y_{2}y_{3})\]  
\[\left(y_{1}^{2}+y_{2}^{2}+y_{3}^{2}+y_{4}^{2}\right)^{2}=\left(y_{1}^{2}+y_{2} ^{2}-y_{3}^{2}-y_{4}^{2}\right)^{2}+\left(2(y_{1}y_{3}+y_{2}y_{4})\right)^{2}+ \left(2(y_{1}y_{4}-y_{2}y_{3})\right)^{2}\]  
**Definitions 1**.: _The definitions of Pythagorean triple and Pythagorean quadruple are given below [52]._  
A Pythagorean triple is an ordered triple of distinct positive integers \((\alpha,\beta,N)\) with a mathematical notation as follows [48]:  
\[\text{Pythagorean triple}(\alpha,\beta,N)\alpha^{2}+\beta^{2}=N^{2},\alpha\
eq\beta \tag{5}\]  
A Pythagorean quadruple is an ordered quadruple of positive integers \((z_{1},z_{2},z_{3},N)\) expressed mathematically as follows:  
\[\text{Pythagorean quadruple}\ (z_{1},z_{2},z_{3},\ N)z_{1}^{2}+z_{2}^{2}+z_{3}^{2} =N^{2},\ \ z_{1},z_{2},z_{3}\text{ not equal} \tag{6}\]  
In this paper, we prove the following theorem with some lemmas:  
**Theorem 1**.: _If a Pythagorean quadruple has a square of a triple and \(N\) is semi-prime, then \(N\) can be factored._  
**Lemma 1**.: _The square product of two primes (each sum of two squares) is four sums of three squares._  
**Lemma 2**.: _The square of a semi-prime is four sums of two squares._  
**Lemma 3**.: _The greatest common divisor of all the two squares factors the semi-prime._  
**Lemma 4**.: _One of the squares of a Pythagorean quadruple represents a Pythagorean triple._  
Lemma 1 produces the four Pythagorean quadruples. Lemma 2 reduces the four Pythagorean quadruples to two Pythagorean triples. Lemma 3 factors the semi-prime. Lemma 4 reduces a Pythagorean quadruple to a triple. Overall, the theorem shows that it is sufficient to only find such a Pythagorean quadruple to factor the semi-prime.