I am having trouble understanding what happens mathematically when a max function is being integrated and for that reason I cannot understand what is happening in the worked examples that are demonstrating this process. Here is the worked example in question:
I have the following functions relating to the estimated remaining lifetimes of 2 machine parts A and B. The remaining lifetime of both parts $\sim U[0,40]$. The policy pays when either part A breaks down or both A and B break down. The problem asks for the covariance of the payment times. I will include parts of the solution below, highlighting what doesn't make sense to me:
X: Time until breakdown of part A Y: Time until Breakdown of part B
Solution says: $Z=\max(X,Y)$ and then goes on to start calculating with $Cov[X,Z]=E[XZ]-E[X]\cdot E[Z]$.
My first question is, based on the context of the question, why is it that $Z=\max(X,Y)$ is a function that stands in for the time until both parts break down.
The next part I do understand fine, but I'm just including it for context:
After Establishing that $E[X]=20$ and that $F_Z(t)=P(X\leq t)\cdot P(Y\leq t)=\frac{t^2}{800} \implies F'_z(t)=f_z(t) =\frac{t}{800}\implies E[Z]=\int_0^{40} t\cdot \frac{t}{800}dt=\frac{80}{3}$
My second question relates to how this max function is integrated
After having figured out E[Z] and E[X], the question moves on to E[XZ]
Here is what I think I'm understanding ok
$\because E[XY]=\int\int xyf(x)f(y) dydx $, applied to this context, where $Z=h(x,y)=\max(X,Y)$, then by LOTUS, we would have $\int\int x\cdot h(x,y)\cdot f(x)f(y)dydx$
For $E[XZ]=E[x\cdot h(x,y)]=\int_0^{40}\int_0^{40} x\cdot \max(X,Y) \frac{1}{40}\cdot \frac{1}{40}dy dx$
HERE is where my understanding breaks down entirely, how does the integration of the max function then become $\int_0^{40}\int_0^{x} x^2 \cdot \frac{1}{1600} dy dx+\int_0^{40}\int_x^{40} xy \cdot \frac{1}{1600} dy dx$
Can someone help me understand how it is that the max function, as an integrand is translated thusly?
For the first question, the combined life span of both parts is the longer of their two individual life spans, right? They aren't both broken until the longer-lived part breaks, that, is, until the maximum of the two life spans has elapsed.
Your second question is easy. In the outer integral, $x$ ranges from $0$ to $40$. In the inner integral, for a fixed $x$ we have that $y$ ranges from $0$ to $40$, which we can regard as $0$ to $x$ and then $x$ to $40$. During the first part ($y$ ranging from $0$ to $x$), $\max(x,y)=x$, and during the second part ($y$ ranging from $x$ to $40$), $\max(x,y)=y$.