The basic question is, given $f(x) = y$ and $f(y) = z$, how can you find $x$ such that $z$ is at its maximum?

I can optimize each equation independently, but I do not know how to optimize when combining equations. A concrete example is as follows:

Imagine forex market that is made up of $x$ and $y$, where $x$ and $y$ are both currencies. Users can send in $x$ to receive $y$, and vice versa. The market structure is defined by \begin{equation} x * y = k \end{equation} where $k$ is a constant number, say $1$, and the product of $x$ and $y$ must always be equal to this number.

The price of $x$ or $y$ is simply $x / y$, such that $k$ always stays the same. If someone sends $x'$ of the currency as payment and receives $y'$ in return, the new equation for the market must be true.

\begin{equation} \dfrac{(x + x')}{(y - y')} = k \end{equation}

Given all this information, imagine you were to make a trade on two markets of this structure. How would you optimize your input, $x0'$, such that your output $x_1'$, is maximized, and $y_0'$ is equivalent on both trades?

\begin{equation} \dfrac{(x_0 + x_0')}{(y_0 - y_0')} = k_0 \;\;\; and \;\;\; \dfrac{(y_1 + y_0')}{(x_1 - x_1')} = k_1 \end{equation}

  • $\begingroup$ I kind of see what you are asking, but my instinct is saying there is a really simple mathematical way of expressing this problem but the description and choice of symbols are obfuscating it.... $\endgroup$
    – Attack68
    Mar 21 '19 at 19:22
  • $\begingroup$ @Attack68 I truly believe it is simple but cannot figure out how to attack it. I tried to simplify it with the first sentence. $\endgroup$ Mar 21 '19 at 19:39
  • $\begingroup$ But then you are just optimising $z=f(f(x))$ or $f(g(x))=z$ if your 2 functions $f$ are not actually the same, so not sure where the difficulty arises (besides it not resulting in a convex or differentiable function) $\endgroup$
    – Attack68
    Mar 21 '19 at 19:42
  • $\begingroup$ @Attack68 then how do you optimize $z=f(g(x))$? Is that simply a derivative of each function? $\endgroup$ Mar 21 '19 at 19:47

To optimize:

$$z = f(g(x))$$

using traditional calculus with chain rule:

$$ \frac{dz}{dx} = \frac{df}{dg} \frac{dg}{dx} $$

Set $\frac{dz}{dx} = 0$ and that will determine either minimum, maximum or saddle points.

  • $\begingroup$ Thank you. Provided there is no other extremely-explicit answer, I will accpet this one. Thank you for your help. $\endgroup$ Mar 21 '19 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.