# Solving an equation and finding a couple of results given that they are integer

My problem is to find all solutions to an equation with 2 variables between two values that define the range of my search. e.g., $(x+y-y²)/(1-y-x²)=0$ with solutions ${x,y} \in \mathbb{Z}$.

-

## 2 Answers

The following might be of use:

````Reduce[x + y == y^2 && x^2 + y != 1, {x, y}, Integers]
````

To ease things, we consider the numerator and denominator separately. Here, we are asking Mathematica for conditions on integer `x` and `y` such that the numerator is zero, and the denominator isn't.

````Solve[x + y == y^2 && x^2 + y != 1, {x, y}, Integers]
````

is useful as well.

If you need examples, you can use

````FindInstance[x + y == y^2 && x^2 + y != 1, {x, y}, Integers, 10]
````

Change `10` to the number of examples you wish to generate.

-

thanks the tip of separating numerator and denominator is great ;) – sol May 14 '12 at 10:36
and for the FindInstance 10 that's what I needed! – sol May 14 '12 at 10:47

You can obtain all integer solutions with `Reduce`:

````Reduce[(x + y - y^2)/(1 - y - x^2) == 0, {x, y}, Integers]
````

which gives

If you also want to restrict to solutions satisfying $x<15$ and $y<42$ then this works

````Reduce[(x + y - y^2)/(1 - y - x^2) == 0 && x < 15 && x < 42, {x,y}, Integers]
````

-

ok thanks and if I want to condition it so that x and y are between [O,1]  (how to condition the solving process?) – sol May 14 '12 at 10:29
you can do that in a way analogous to the second example I gave – acl May 14 '12 at 10:34
yep thanks Acl ^^ – sol May 14 '12 at 10:37
lang-mma
{"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": 4, "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.3, "absolute_threshold": 20, "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.8714382648468018, "perplexity_flag": "middle"}