### computer science problem

Hi guys I'm new to the site and I was wondering if you could helpwith a problem I've been struggling with. Well, here it goes:

Determine the sets S, such that:
1. S contains only natural numbers
2. S contains at least two elements
3. ∀x, y ∈ S.(x > y) ⇒
(xy)/(x2-y2)∈S

p.s.: well in words the point 3 is (x times y) over/fraction (xsquare-ysquare)
While I would love to help, the symbols you used in your third point have confused me, would you mind explaining it in words, please.
closed account (o1vk4iN6)
More of a math problem than computer science.

For all x and y in S, if x is greater than y then (xy)/(x^2-y^2) is in S.

Is what I think you are looking for script coder.
i couldn't have put it into words better than xerzi so yeah that's the idea. I know it doesn't sound like a computer science problem but it was given as homework by my computer science professor at the university... I have taught as possible solution all the sets of this form {k,0} where k (as in x) can have any natural value except 0 and the conditions are met, but I am not sure if it's the only solution or how to show that it is.
@xerzi
Thank you, that is exactly what I was looking for.

@valix
I do not know if 0 is included.

http://en.wikipedia.org/wiki/Natural_number

as for a solution, I just read this, so I will keep trying.
So for problem 1, you can do x = n - (floor(n)), where n is each number in your set. If x > 0, then n cannot be a natural number. You need to include <cmath> to use floor().

For problem 2, use sizeof.

For problem 3, first check if x > y. If this is true, set a variable z to be equal to (xy)/(x^2-y^2) and then search S to see if that number appears.
@Mats

the three points I have listed are part of the same problem and the purpose is not to write a program to solve it (that would be pretty convenient:D). The problem has to have a mathematical or logical solution/method/explanation whichever is best. You can say that it's the old pencil and paper approach.
Well, proving all sets of the form {k, 0} where k∈ℕ is rather straightforward.

1. Observe that 0∈ℕ, and that k∈ℕ by definition.
2. Observe that the set has 2 elements.
3. The only possible pairing of elements (x, y) from the set where x > y is (k, 0), and when x=k and y=0, the expression (x*y)/(x2-y2) = 0 which is also in {k, 0}

So the sets {k, 0} where k∈ℕ are all solutions. QED

If you want to prove that such sets are the only solution, I'd tentatively try a proof by contradiction; assume there exists some other set not in the category of "{k, 0} where k∈ℕ" that still meets the requirements, then derive a contradiction from the set's definition and the requirements to be a solution.
I am going to say that there are no such sets (assuming 0 is not allowed).
This is why:

let xy/(x^2-y^2)=a
xy=ax^2-ay^2
ay^2+xy-ax^2=0

and as far as I know that cannot factories, and if it can those should be your solutions.
PLEASE NOTE: This could be (is probably) very wrong. Use with caution and much checking.
I didn't think of it that way...

With that result, we can say the sets that are solutions must contain a 0, then prove all two-element sets with 0 are solutions as I did above. Then I feel like we could prove by contradiction that a set with any additional natural numbers included would break rule 3 for solutions.
@ Script Coder

That's actually a very good idea. Assuming that a cannot be 0 and after some not too difficult calculations I arrived at a contradiction meaning that a has to be 0. If a is 0 then xy has to be 0, but x>y so y has to be 0.
As 0 must be an element of the set S. the only problem that remains is what about the other values, like how many elements does the set S have? Assuming that the set S has a number of elements bigger than 2 let's say 3, than that would mean that we will have 2 or more non-zero values, different from each other, say for example the set {0,1,2} and in this case for y=1,x=2 the rule 3 wouldn't work. This is kind of a combination of @zhuge's idea and yours. Thanks a lot. This problem was bugging me for three days.
Topic archived. No new replies allowed.