It’s a right triangle so start by using SOH CAH TOA, an acronym that helps with the relationships in a tight triangle. You want to find the side adjacent to the angle, so you would use the middle part; CAH which means cosine adjacent over hypotenuse. So cosine of 45 degrees is equal to x divided by 3root(2).
Then you solve the equation for x to get x = cos45° * 3(sqrt(2))