Start with simple equations.
x = cheap side
y = expensive side
6x + 9y = 9000
Area = xy
Next combine the two equations.
y = 1000 - 2x/3
Area = x(1000 -2x/3)
Finally, take the derivative of that area equation to find the maximum.
For the second one
income = rent x occupied apartments - repairs
occupied apartments = 50 - (rent - 900)/25
repairs = 50 x $75
Combine and find where income is a maximum