Hi, I hope I can get some help with this problem. The class is called "Formal models of computation". It's a computer science course where we talk about models of how computers work, Turing machines, automatons, etc. It's kind of like Discrete Math for computer science (which I hated).
Give functions f: E -> E (where E is the set of even integers) that fulfill the following properties
a. f is one-to-one, but not onto or total
b. f is total, but not one-to-one or onto
c. f is total, one-to-one and onto, but is not the identity function (f(x) = x)
d. f is not total or one-to-one, but is onto.
I have part c figured out but can't come up with anything for the other 3. Everytime I come up with a function for one property it doesn't meet the other ones. The professor wants the functions to be in the form f(x) = something. We are not allowed to create subsets of set E either. The functions have to work over the entire set E.
Thanks for any help.
is not total, so we must exclude at least one even integer from being a valid input to . The square root function permits only positive numbers as inputs, so that looks a likely candidate.
is onto, so we have to find some way of generating negative as well as positive outputs. So I thought of as a candidate, because, as goes alternately odd and even, has values -1, 1, -1, 1, ...
is not one-one, so there must be at least two different input values that generate the same output value.
So I played around with these ideas and came up with (wait for it!)
So: can only take (positive) even perfect squares as values: 0, 4, 16, 36, 64, 100, ... Therefore is not total.
For these values of , then:
Note that . So is not one-one, but it is total, because any even integer (positive or negative) can be generated using a suitable value of .
I think you need a twisted mind for this sort of thing!