Derive a formula with interacting variables (with example problem)

linear algebrapartial differential equationsrecreational-mathematicssequences-and-series

Imagine you are an enterprising child: and instead of starting a lemonade stand, you open a lemonade bank.

People can deposit lemons or sugar. In return, they get credit at your bank which they can used to withdraw either lemons or sugar.

Your mom gives you 1 lemon and your dad gives you 1 ounce of sugar. You issue each of them 1 unit of credit in return. Your bank has been seeded.

You decide you wish to maintain a 1:1 ratio between lemons and sugar. You decide you will do so by issuing more credit for deposits of what you have less of while charging more credits to withdraw what you have less of, and vice versa.

If your mom gives you another lemon and you issue her another full unit of credit then lemons will account for 67% of all credit issued, while lemons would be worth the same amount of credit as sugar (so 50%). If sugar is more valuable to the external market your mom could deposit lemons and extract sugar cheaply.

This will not do. This is why you must have a dynamically adjusting credit issuance which depends on the resulting internal ratio after any transaction.

So your mom says she would like to deposit another lemon into your bank. You currently have 1 lemon, 1 ounce of sugar, and 2 credits issued (in circulation). You must give your mom an amount of credit in return for her lemon, but how much? Giving her a full credit could result in an imbalance, so you must give her less than a full credit, but how much less?

You decide to guess. You think, "if I give a full credit, then all credits in circulation (3) will be backed by 2 lemons and 1 ounce of sugar, so 67% backed by lemons. So instead of 1 full credit, I'll give her .67 credits in return for the second lemon."

You realize this is a good guess because now 2.67 credits will be backed by 2 lemons at .67 credits apiece, totaling 1.34 credits; exactly half of 2.67. You have maintained 1:1 ratio in the value of lemons to sugar regardless of their count. But that makes you realize, now the 1 ounce of sugar in the bank is worth 1.34 credits instead of 1. Sugar's price has increased, in fact, in terms of lemons, it's now twice as valuable.

This dramatic change doesn't quite sit well with you so you tell your mom you'll have to get back to her about the amount of credit you will issue to her for her second lemon deposit.

You decide to do a comparison of scenarios just to recap. If you paid out 1 credit for the lemon then your bank credit would be backed by 67% lemons and 33% sugar, and lemons would cost the same as sugar or you could say lemons would account for 50% of the cost. If instead, you paid out .67 credits for the lemon then your bank credit would be backed by 50% lemons and 50% sugar, but lemons would account for 33% of the cost.

2 scenarios

You already ruled out the first scenario, but the second scenario seems to push the imbalance into the price, rather than the backing of your credit. The second scenario seems like an over-correction. So you want to strike a balance somewhere between .67 and 1 credit. But where?

It seems you want to balance the two concerns so that they are mirror images of one another: the backing % for lemons should equal 1 – the unit cost % for lemons. But you don't know the formula to achieve such a balance. So again, you guess. Perhaps smack dab in the middle: .67+((1-.67)/2)~.83334 You give that a try:

3rd guess

Turns out that's really close: you compare 58.8% backing for lemons to 58.3% unit cost for ounces of sugar. It's almost a perfect match. But you're kind of a little psycho and you want the exact formula to balance the two concerns.

Why didn't the middle of 2/3rds and 1 give you the perfect balance you were looking for?

How would you create such a formula? What if your mother wanted to deposit 2 more lemons into your bank or withdraw .5 lemons?

Given this kind of input to the formula, what is the credit cost per lemon you should charge or pay?

EDIT (follow up):

Turns out the exact balance is 0.82842712474619. Which was arrived at iteratively. My question is, can a function be derived that computes this number? If so, how? and what is the function?

manual

EDIT:

How are you calculating the backing?

Backing is calculated by multiplying the cost (or how many credits you're willing to mint) by the number of that asset, for each asset.

Continuing with the above example, imagine you go to your mom and accept her 2nd lemon deposit in exchange for the 0.82842712474619 credits. Once the transaction is carried out you would be in the situation outlined by the last spreadsheet image above; namely, you would have 2 lemons and 1 ounce of sugar in your bank, and you would have issued 2.82842712474619 credits in total.

So 2 lemons * 0.82842712474619 credits = 1.65685424949238 credits are backed by lemons and since there are 2.82842712474619 credits in circulation then we know 2 things: A) 1.65685424949238 / 2.82842712474619 = ~58.6 % so what we really mean is that each unit of credit in circulation is backed 58.6% by lemons and ~41.4% by sugar, B) which means we know the implied updated sugar price even though no sugar transaction has occurred: 2.82842712474619 credits in circulation - 1.65685424949238 credits accounted for by lemons = 1.17157287525381 credits accounted for by sugar (aka backed by sugar). To get the price of sugar we merely divide the total number of credits backed by sugar by the number of ounces of sugar: 1.17157287525381 credits / 1 sugar ounce = 1.17157287525381 credits.

How are you calculating the cost?

That is explained above, but to get the percentage, of course, we simply add up how much each asset costs and divide by the total. Thus 1.17157287525381 sugar cost + 0.82842712474619 lemon cost = 2 total cost so 0.82842712474619 / 2 ~ 41.4 % and 1.17157287525381 / 2 = 58.6 %

Again, notice the cost percentages per asset are the inverse of the backing percentages. That's what I mean by balanced. Finding the right cost for the number of units proposed to be traded that produces this inverse mirrored relationship is the entire goal of the quadratic function we're trying to deduce.

That means if your mom had wanted to deposit 3 or 40 lemons the number of credits you would have issued her per lemon would have been lower than 0.82842712474619. If she had wanted to withdraw the number of credits you would have required of her would have been higher (withdrawing might actually be more nuanced because there's a limit to how many you can withdraw, let's not go down that rabbit hole). I just wanted to say that the relationship between how much someone wants to deposit and the price you will pay per unit has a curve to it, not sure what that curve looks like but I imagine it's something like this:

curve

I'll make additional edits to answer your questions later, but I hope this is sufficient in the meantime to show how backing % and costs % are calculated.

EDIT:

I hope you have enough to define the problem but I'll try to explicitly answer the other questions too:

  1. you say credit can be used to withdraw "either lemons or sugar."
    What do you mean by this? Do you mean 1 unit of credit can be used to
    withdraw 1 lemon or 1 ounce of sugar? Or are you setting prices
    dynamically?

dynamically, in fact, the whole point is to map an amount of any asset someone has to deposit to an amount of issued credit that will balance the two concerns listed above. the amount of credit that is issued must be dynamic.

  1. What do you mean by "lemons will account for 67% of all credit
    issued"" in paragraph 5? What implicit relationship between deposits
    and credit is being tracked here?

"If your mom gives you another lemon and you issue her another full unit of credit then lemons will account for 67%" because you would have 2 lemons and you would have issued 3 credits and the price of lemons would be 1 credit. so 2 lemons * 1 credit = 2 credits and 2 credits (for lemons) / 3 total credits

  1. What do you mean by "while lemons would be worth the same amount of
    credit as sugar" in paragraph 5? This seems to imply that you don't
    have the freedom to set prices dynamically; is that right? If so, how
    are the prices being set?

"If your mom gives you another lemon and you issue her another full unit of credit then lemons will account for 67% of all credit issued, while lemons would be worth the same amount of credit as sugar" means if you paid 1 credit for another lemon, lemons, and sugar would be the same price. it doesn't mean prices are not dynamic. At this point in the word-problem, I'm trying to show why prices must be dynamic by showing what would happen if you treated them as static.

  1. In paragraph 8 you say "all credits in circulation (3) will be backed by 2
    lemons and 1 ounce of sugar, so 67% backed by lemons" which seems to imply that
    each deposit backs each credit proportionately. But in paragraph 9 you say "now
    2.67 credits will be backed by 2 lemons at .67 credits apiece, totaling 1.34
    credits"; why?

If you pay 1 full credit the number of credits in circulation would be 3. if you pay .67 credits the number of credits in circulations would be 2.67. I hope that helps.

  1. cont.: specifically, why does the .67 credit number also apply to
    the first lemon, which was deposited for 1 credit? Why isn't the
    backing calculation being done as follows: 2.67 credits are backed by
    2 lemons and 1 ounce of sugar, so 2.67 / 3 = 0.89 credits apiece for
    each of the 2 lemons and the ounce of sugar? Or: each deposit backs
    the credit it was exchanged for, so 1 credit for the sugar, 1 credit
    for the first lemon, 0.67 for the second lemon?

Because the current price of lemons is the latest price they transacted for. We don't care what lemons went for in the past, they are priced as of now. the system has (or would have, after the transaction is completed) 2 lemons, whatever price is chosen in the transaction is the value that the system thinks lemons are worth – all lemons.

  1. In paragraph 11, what do you mean by "but lemons would account for
    33% of the cost"? The cost of what? You seem to have calculated this
    number by dividing 0.67 by 2. But what does the 2 represent here?

I'm dividing by 2 because you can add up all the prices of the assets and you come up with 2. so this asset's (lemon's) price represents a certain % of the total of all prices of assets in the system. That what it is, but technically price of sugar which makes up the rest of the number 2 is actually implied by the total credits in circulation as explained in the 3rd paragraph of my previous EDIT.

FINAL EDIT:

Here is the generalized solution (see comments of the answer below):

e = existing lemons (1)(1) (state)
d = deposit lemons (1)(2) (input variable)
s = existing sugar (1)(1)(state)
c = existing credits (2)(2) (state)
x = cost of lemons (.8284...)(.73...) (output)

general solution

(the second equation is for a deposit, not sure how to apply the first one, perhaps to withdrawals.)

Best Answer

Here's a neat feature I didn't realize existed; you can ask WolframAlpha if it thinks a constant has a closed form and it will spit out suggestions. For your $0.8284 \dots$ it suggests

$$2 \sqrt{2} - 2 = \frac{2}{\sqrt{2} + 1} \approx 0.82842712474619 \dots $$

which is an exact match to all of your digits.

I don't understand your problem statement (I put a long list of questions into the comments) but fortunately the mathematical content can be reverse-engineered from the spreadsheet screenshots alone, together with the big hint that it should all come down to solving a quadratic equation. It looks like if you pay out $x$ credits for the third lemon then the spreadsheet reads

$$\begin{array}{cccc} \text{assets} & \text{units} & \text{backing} & \text{cost} \\ \text{lemons} & 2 & 2x & x \\ \text{sugar} & 1 & 2 - x & 2 - x \\ \text{total} & 3 & 2 + x & 2 \\ \end{array}$$

(I don't understand this, especially the backing calculations) and the condition you want appears to be that the fraction of the cost (I don't understand what this means) made up by the lemons, which is $\frac{x}{2}$, is equal to the fraction of the backing (I don't understand why you're calculating this the way you are) made up by the sugar, which is $\frac{2 - x}{2 + x}$, so

$$\frac{x}{2} = \frac{2 - x}{2 + x}.$$

Clearing denominators gives a quadratic equation

$$x^2 + 4x - 4 = 0$$

which has unique positive real solution $x = 2 \sqrt{2} - 2$. But given the lack of precision in the problem statement I am not at all confident that this is the number you actually wanted.

Edit: Here is my current understanding of how this calculation generalizes to arbitrary numbers. Suppose we have $L$ lemons, $S$ ounces of sugar, and $C$ credits in circulation, and Mom wants to deposit $L'$ new lemons and we want to determine how many credits $x$ to give her. If I've understood everything correctly, the spreadsheet should now read

$$\begin{array}{cccc} \text{assets} & \text{units} & \text{backing} & \text{cost} \\ \text{lemons} & L + L' & (L + L')x & x \\ \text{sugar} & S & C + (1 - L - L')x & \frac{C + (1 - L - L')x}{S} \\ \text{total} & L + L' + S & C + x & \frac{C + (1 - L - L' + S)x}{S} \\ \end{array}$$

(this shouldn't be telling you anything you didn't already know because you must already have formulas equivalent to these in your spreadsheet if I've correctly understood the problem). The fraction of the cost made up by lemons is now $\frac{Sx}{C + (1 - L - L' + S)x}$, while the fraction of the backing made up by sugar is now $\frac{C + (1 - L - L')x}{C + x}$, and the condition that these are equal is

$$\frac{Sx}{C + (1 - L - L' + S)x} = \frac{C + (1 - L - L')x}{C + x}$$

which is again, after clearing denominators, a quadratic equation in $x$.

Related Question