Question 1208084
<font color=black size=3>
If x is rational, then y = 1.
If x is irrational, then y = 0.
x cannot be both rational and irrational at the same time. 
The name "irrational" literally means "not rational".
Therefore any input leads to exactly one output, and we can conclude that <font color=red>this is a function</font>.


--------------------------------------------------------------------------


The <font color=red>domain is the set of all real numbers</font>. 
Applying a set union to the rational and irrational subsets will yield the set of all real numbers.
In other words, a real number is either rational or it is irrational, but not both at the same time.
There are no domain restrictions to worry about.


The <font color=red>range is the set {0,1}</font> since these are the only outputs possible.
Don't forget about the surrounding curly braces.


--------------------------------------------------------------------------


x = 0 is rational, which maps to y = 1.
Therefore the <font color=red>y-intercept is 1</font>.
This represents the location (0,1) on the graph.


x being irrational leads to y = 0, so <font color=red>any irrational value is an x-intercept</font>. 
There are infinitely many of these.
A few examples: 
sqrt(2)
pi
sin(5)


--------------------------------------------------------------------------


y = f(x)
We have these rules<ul><li>f(x) is even when f(-x) = f(x) for all x in the domain.</li><li>f(x) is odd when f(-x) = -f(x) for all x in the domain.</li></ul>Your particular function is not odd since something like f(-2/3) = -f(2/3) is false. The left hand side evaluates to 1 while the right hand side evaluates to -1. 


If x is rational, then f(x) = 1
Since x is rational, so is -x, which leads to f(-x) = 1 as well.
Both result in 1, so f(x) = f(-x) is the case when x is rational. This proves y-axis symmetry when x is rational.
Similar symmetry is proven when x is irrational.
Therefore, <font color=red>f(x) is even</font>.


--------------------------------------------------------------------------


The graph is a bit tricky. 
To the untrained student, it appears that we have two horizontal lines y = 0 and y = 1.
However, it turns out that we have infinitely many disconnected island points that are just packed in really tightly together. 
This is an optical illusion that the points seem to connect. No matter how much we zoom in, this illusion will persist.


How can we prove this discontinuity?
I'll show points on y = 1 are separate islands.
Consider rational numbers m and n where m < n.
The goal is to show that an irrational value is between these endpoints.
It turns out there are infinitely many irrationals between m & n, but we only need to find one such irrational.
If we can do this, then we'll show that there's no way to connect neighboring points on the same horizontal line.


Let epsilon be an irrational value such that
0 < epsilon < n-m
The value of m+epsilon is irrational. Proof will be left to the student.
If you are stumped, then check out this resource
https://proofwiki.org/wiki/Rational_Number_plus_Irrational_Number_is_Irrational
Furthermore, m+epsilon is between m and n since I've constructed epsilon in a way to guarantee we land between the mentioned endpoints.
Example: m = 1, n = 2, epsilon = (n-m)/pi = 1/pi = 0.3183 (approx), and m+epsilon = 1+0.3183 = 1.3183 (also approx).


Therefore, we have proven that at least one irrational number is between any two rational numbers.
This shows it's impossible to connect neighboring points on the line y = 1. It doesn't matter how close the neighbors are. 
We can find an irrational value between those neighbors which will drop us down to the lower line.
All of the points on y = 1 are disconnected floating islands.



If you want to prove that points on the line y = 0 are also separate islands, then check out this page
https://math.stackexchange.com/questions/421580/is-there-a-rational-number-between-any-two-irrationals
Responses on that page prove that any two irrationals will have at least one rational between them. Turns out actually there are infinitely many rationals but we only need one such rational. So we have the same thing going on as with y = 1.


Further Reading
https://mathworld.wolfram.com/DirichletFunction.html


--------------------------------------------------------------------------


Summary:<ul><li>Is it a function? <font color=red>Yes</font></li><li>Domain: <font color=red>All real numbers</font></li><li>Range: <font color=red>{0, 1}</font></li><li>y-intercept: <font color=red>y = 1</font></li><li>x-intercepts: <font color=red>set of irrationals</font> (infinitely many)</li><li>Even? Odd? Neither? <font color=red>Even</font></li><li>Graph: <font color=red>See above</font> The short version is that we have infinitely many points clumped together that appear to resemble the lines y = 0 and y = 1. But be careful: this is an optical illusion. All points are disconnected floating islands.</li></ul>
</font>