# Correctness of Fermat's Factorization

Is this proof correct:

An odd integer $n \in \mathbb{N}$ is composite iff it can be written in the form

$n = x^2 - y^2, y+1 < x$

Proof:

$\leftarrow$

Want: $n = ab$ Where $a$ and $b$ are odd integers (since $n$ is odd)

Let $n = x^2 - y^2, x > y + 1$. Let $x = \dfrac{a+b}{2}$ and let $y= \dfrac{a-b}{2}$ where $a$ and $b$ are odd integers.

Consider $n = x^2 - y^2$:

$= (x+y)(x-y) \iff (\dfrac{a+b}{2} + \dfrac{a-b}{2})\cdot(\dfrac{a+b}{2} - \dfrac{a-b}{2})$

Thus we have $ab$.

Now I could do similar steps backwards to prove the other direction.

-

It looks solid, except that you should explicitly mention where the condition that $x\gt y+1$ comes into play (hint; there's another condition on $a$ and $b$ that you haven't mentioned - actually, two more, one being $a\geq b$ since $y$ is positive...) – Steven Stadnicki Sep 30 '12 at 17:32
Is it the fact that $x \geq \lceil \sqrt n \rceil$? – CodeKingPlusPlus Sep 30 '12 at 17:49
No, that's actually moot - it's what that condition implies about $a$ and $b$.  (Slightly larger hint: every number $n$ has a factorization $n=ab$; what do you need to ensure that $n$ isn't prime?) – Steven Stadnicki Sep 30 '12 at 18:55
$a \neq 1$ and $b \neq 1$ – CodeKingPlusPlus Sep 30 '12 at 20:51

## 1 Answer

The part when you say "Let $x=\frac{a+b}2$ and let $y$..." is not really clear. In the $\Leftarrow$ direction $x$ and $y$ should be considered as given, and define $a$ and $b$ using them, and show that they are integers.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 35, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9395979642868042, "perplexity_flag": "middle"}