You could subsitute g(x) for x in f(x) and if you get x as a result, then that is indeed the inverse
ex
if
f(x)=x-2
the inverse which is g(x) is
g(x)=x+2 because if you did
f(g(x)) then you would get
f(g(x))=(2+x)-2=2-2+x=x
Lagrange multipliers:







(if

)

(if

)

(if

)
In the first octant, we assume

, so we can ignore the caveats above. Now,

so that the only critical point in the region of interest is (1, 2, 2), for which we get a maximum value of

.
We also need to check the boundary of the region, i.e. the intersection of

with the three coordinate axes. But in each case, we would end up setting at least one of the variables to 0, which would force

, so the point we found is the only extremum.
Add up all the sides of the rectangle
You can work these in your head if you consider the revenue generated by the least contributor (children's tickets) and the difference in revenue between that and the larger contributor ($2.00 -1.50 = 0.50).
If all were children's tickets, the revenue would be 500*$1.50 = $750.00. The actual revenue exceeded that amount by $862.50 -750.00 = 112.50. This difference in revenue is made up by the sale of $112.50/$0.50 = 225 adult tickets. Then the number of children's tickets is 500 -225 = 275.
225 adult tickets were sold
275 children's tickets were sold.
_____
If you need an equation, you can write an equation using a variable for the number of adult tickets sold (the largest contributor).
.. (500 -a)*1.50 +a*2.00 = 862.50
.. 0.50a = (862.50 -750.00) . . . . . does this look familiar, yet?
.. a = 112.50/0.50 = 225