I have a multivariable function $F(x, y) = a(y^2+x)$ representing the total manufacturing output of some process. $x$ and $y$ are variables representing the quantity of resources of each type input into the process and $a$ is a constant which depends on the machine used.
The idea is that we are using the process $F$ which accepts quantities of two types of resources ($x$ and $y$), of which $y$ is far superior (it contributes exponentially to the number of products produced whereas $x$ contributes linearly).
Now, $x$ is cheaper to procure than $y$. So the total cost of a manufacturing run is given by:
$C = tx + wy$
Where $t$ is the cost per unit of $x$ and $w$ is the cost per unit of $y$.
My goal is to find the ideal combination of $x$ and $y$ to fulfill a customer's order of $P$ products. That is, the cheapest combination of $x$ and $y$ which will yield $P$ as the value of $F(x, y)$.
How can I approach this a problem?
Edit:
Thanks to the tip about using Lagrangian multiplier, I now have the following:
$P = ay^2 + ax$ <-- The constraint function
$C = tx + wy$
Let us define the Lagrangian:
$\mathscr{L}(x, y, \lambda)=tx + wy -\lambda(ay^2+ax-P)$
$=tx + wy -a \lambda y^2 -a \lambda x +\lambda P$
We take the partial derivatives and set to zero to get the critical points of the Lagrangian:
$0 = \frac{\partial \mathscr{L}}{\partial x} = t-a \lambda$ $\dagger$
$0 = \frac{\partial \mathscr{L}}{\partial y} = w-2a \lambda y$ $\ddagger$
And we have our constraint function, with $P$ substituted for the output:
$0 = -ay^2 - ax + P$
So the derivative of the Lagrangian at the critical points is given by:
$\nabla \mathscr{L} = \begin{bmatrix} t-a \lambda \cr w-2a \lambda y \cr -ax - ay^2 + P\end{bmatrix} = \begin{bmatrix} 0\cr 0 \cr 0 \end{bmatrix}$
From here I am unsure how to interpret this result to find the minimum of $C$ in terms of $x$ and $y$.
When I try to work out the values for $x$ and $y$ I run into a problem: using the derivative in $\ddagger$ I can get $y$ in terms of $\lambda$ but because the derivative in $\dagger$ does not have a $x$ term, I don't see how I can get $x$ in terms of $\lambda$. I am sure I am missing something here.
This is an equality constrained minimization problem.
You want to minimize $C(x,y) = tx + wy$ given that $F(x,y) = a(y^2+x) = P$ or $G(x,y)=a(y^2+x)-P = 0$, which is the equality constraint.
This type of problem can be solved using Lagrange Multipliers, in which we define a new function $\mathscr{L}(x,y)$, called the Lagrangian.
$$\mathscr{L}(x,y,\lambda) = C(x,y) - \lambda G(x,y)$$
We then minimize this new function. To do so, we must obtain the gradient of the Lagrangian and then calculate the point $P=(x,y,\lambda)$ which makes the gradient be zero.
$$\nabla \mathscr{L} = \begin{bmatrix} t-a \lambda \cr w-2a \lambda y \cr -ax - ay^2 + P\end{bmatrix} = \begin{bmatrix} 0\cr 0 \cr 0 \end{bmatrix}$$
Now we solve for $x, y$ and $\lambda$. From the first term of the gradient we get:
$$\lambda = \frac{t}{a}$$ Substituting this in the second term, we get:
$$y=\frac{w}{2t}$$
Finally we can solve for $x$ with the third entry of the the gradient:
$$x=\frac{P}{a}-\frac{w^2}{4t^2}$$
We now know that the point $P_c=(\frac{P}{a}-\frac{w^2}{4t^2},\frac{w}{2t},\frac{t}{a})$ is a critical point of the Lagrangian. But to tell whether it's a minimum or a maximum, we use the discriminant, which is the determinant of the hessian matrix, defined as:
$$H(x,y, \lambda)=\begin{bmatrix} {\frac{\partial^2 \mathscr{L}}{\partial^2 x}} & {\frac{\partial^2 \mathscr{L}}{\partial x \partial y}} & {\frac{\partial^2 \mathscr{L}}{\partial x \partial \lambda}} \\ {\frac{\partial^2 \mathscr{L}}{\partial y \partial x}} & {\frac{\partial^2 \mathscr{L}}{\partial^2 y}} & {\frac{\partial^2 \mathscr{L}}{\partial y \partial \lambda}} \\ {\frac{\partial^2 \mathscr{L}}{\partial \lambda \partial x}} & {\frac{\partial^2 \mathscr{L}}{\partial \lambda \partial y}} & {\frac{\partial^2 \mathscr{L}}{\partial^2 \lambda}} \end{bmatrix}$$
Calculating all these derivatives, gives us:
$$H(x,y, \lambda)=\begin{bmatrix} {0} & {0} & {-a} \\ {0} & {-2a\lambda} & {-2ay} \\ {-a} & {-2ay} & {0} \end{bmatrix}$$
The discriminant is then:
$$D(x,y,\lambda)=|H(x,y,\lambda)|$$ $$D(x,y,\lambda)=2a^3\lambda$$
Now, the point we found will definitely be a minimum if the discriminant is greater than zero on it.
$$D(P_c)=2ta^2$$
Since $a^2$ is always positive, it then depends on the value of $t$ whether the point is a minimum. If $t>0$ then the point $P_c$ will be the minimum, if $t<0$ then it will be a maximum, and if $t=0$ or $a=0$ then the hessian test is not enough.