I have this
$f(x,y) = \begin{cases} \frac{1}{4}, \text{if $(x,y)$ $\in$ $[0,2]^2$}\\ 0, \text{else} \end{cases} $
And I need to find $P(X + Y < 1).$
This is the solution: $$\int_0^1 \int_0^{1-x} \frac{1}{4} \,dydx = \frac{1}{8}$$
How can I reach it?
I tried this: $$P(X+Y \leq 1) =\int_0^2 \int_0^{1-y} \frac{1}{4} \,dxdy = ... = 0$$
My logic was - go over all values possible for $Y$ ($0$ to $2$) and then when $Y$ is a constant, $x$ can be from $0$ to $(1-Y)$.
It seems that I missed only the limits part. Why am I wrong? Why did they use $0$ to $1$ and not $0$ to $2$ like me?
Thanks

The relation between a joint density function for the random vector $(X,Y)$ and a probability that can be represented as $$P\big((X,Y)\in B\big),$$ where $B$ can be almost any subset of $\mathbb R^2$ that you can think of (*) it's actually a very simple relation. It goes $$P\big((X,Y)\in B\big)=\iint_B f(x,y) dA,$$ where $dA$ is sometimes also written as $dx dy$ or $dy dx$. The integral can be taken to be a double Riemann integral if it exists for such set $B$. It is not a difficult probability-related problem... but actually finding the value of the double integral might sometimes be non-trivial or even an extremely hard calculus problem. So it can be helpful to think these exercises in two steps:
(Step 1) The desired probability equals the value of a certain double integral, say: $$P(X+Y<1)=\iint_B f(x,y) dA,$$ where $B\subset \mathbb R^2$ is $$B=\{(x,y)\in \mathbb R^2\colon x+y<1\}$$ (that is, the half plane under —and not including, although here this is irrelevant— the straight line with equation $y=1-x$).
(Step 2) Find the value of the double integral. The important fact is that this double integral over a subset $B$ of the real plane ($\mathbb R^2$) is not actually defined in terms of simple integrals (integrals in one variable), but in terms of a limit process of taking certain sums involving geometric concepts such as surface and volume, pretty much as integrals on one variable themselves are defined. Since the definition of double integral tends to be of very little practical use for actual calculations, there is an important theorem (Fubini) which says that a double integral can be written in terms of two simple integrals, one in each variable, taken one after the other, and in such a manner that the borders of the region define the integration limits (while the type of region —that is 'type 1', type 2', 'type 3'— determines which order of integration can be followed). This is something that you can review from your calculus books and notes (and of course, you can ask for help on that to), but I think that it will be useful to think of this as a calculus problem, so you can focus on the only probability-related concepts and relations involved, as we did in Step 1).
But... it is of conceptual interest both for calculus and probability one important fact: $f$ is the zero function outside the square $[0,2]^2$, so the only region of interest for the integration is the intersection of $B$ with that square. So actually, you can say that $$P(X+Y<1)=P\big(X+Y<1 \; \wedge \; (X,Y)\in [0,2]^2\big)=\iint_{\tilde B} f(x,y) dA,$$ and $\tilde B$ turns out to be the triangle of vertices $(0,0)$, $(1,0)$ and $(0,1)$, and the application of Fubini's theorem gives the solution you mention at the beginning.
I insist, try to see that the real difficult is in a calculus concept, more than a probabilistic one... and then you'll find probability and statistics much simpler.
(*) More precisely, $B$ can be any borelian set. This family of sets includes pretty much any subset of $\mathbb R^2$ that you could come up with... unless you get really really REALLY eccentric and pretentious. ;)