So with the basic definition out of the way you should notice right away with some functions you cannot put certain values into x and get out a y
for example,
y = 1/x
you should notice right away if we set the input variable, x=0 we have a problem,
y = 1/0
You cannot divide by zero, it gives us an undefined output value.
So we can say that 0 in this case is not in the domain of the function, because the domain is just the values of x that can be plugged in a function to give a value y
we can denote that by using set notation
(-infinity, 0),(0,+infinity)
round brackets basically mean that the function can have values plugged into it that go infinitely close to the number that cant be plugged in (you can plug in 0.000000000000000000000001 because it isn't zero), you always use round brackets with infinities
square brackets are used when the number is included in the function but stops after for example,
y = x^(1/2)
its domain would be,
[0, +infinity)
you cant take the square root of a negative number, but you can take the square root of zero
Note: some teachers request different notations so you might want to consult with them but this is what is normally used from my experience.
The range is essentially similar to the domain the only difference is it is concerned with allowed output values