You are building office space and have contracted to supply 10 units of space, half at the end of year 1 and half at the end of year 2. Because large building projects are inefficient, the cost of building $x$ units of space is $x^2$ . However, if you produce more than 5 units in the first year, you can rent out the excess space during the second year at 8 units of money per unit of space. It might be optimal to do something like producing $x = 6$ in the first year, renting out 1 unit for a year, and producing only $y = 4$ in the second year.
Write down the function of $x$ and $y$ to be minimized and the constraint, then use a Lagrange multiplier to find the optimal amount to produce during the first year.
I'm quite new to the idea of Lagrange multipliers, so trying out this question, I got the constraint as $x+y=10$, but I'm not sure what the function that we are trying to minimise should be. Could someone guide me as to how we can come up with that function?