# Translating text to functions

I am having problems understanding how to extract this information into a formula.

The sum of two nonnegative numbers is 1. Express the sum of the square of one and twice the square of the other as a function of one of the numbers.

(note, i do have have the answer to the question, my question is on how to extract the information)

Any help would be much appreciated, Cheers!

-
One way is to call one of the numbers $x$. Then the other is $1-x$. Now you can probably write down in symbols "the sum of the square of one and twice the square of the other." – André Nicolas Jun 24 '14 at 6:13

I will go through it very slowly so that you have lots of examples of how do things like this. Please don't be insulted; it just pays to be careful because this is a very detail-oriented task. First give the things you want to find names: they're natural numbers so I'll call one $n$, and one $k$.

Then look at the information, piece by tiny piece:

The sum of …

$$+$$

… two nonnegative numbers …

$$n+k$$ $$(n\geq 0, k\geq 0)$$

… is …

$$n+k=$$ $$(n\geq 0, k\geq 0)$$

… $1$.

$$n+k=1.$$ $$(n\geq 0, k\geq 0)$$

That wasn't so bad! The second sentence is yet another bunch of words we want to turn into symbols, so here goes:

The sum of …

$$+$$

… the square of …

$$()^2+$$

… one [number] …

Now we have a choice; we can either use $n$ or $k$. I'll choose $n$:

$$(n)^2+$$

… and twice …

$$(n)^2+(2*)$$

… the square of …

$$(n)^2+(2*()^2)$$

… the other [number] …

This time we do not have a choice; we must use $k$ (or if we had used $k$ last time, then this time we must use $n$): $$(n)^2+(2*(k)^2)$$

… [Express this] as …

$$(n)^2+(2*(k)^2)=$$

… a function of …

$$(n)^2+(2*(k)^2) = f()$$

… one of the numbers.

Again, we have a choice; I'll choose $k$ this time.

$$(n)^2+(2*(k)^2) = f(k)$$

In those last few steps, we took the final form, which without parentheses is $n^2+2k^2$, and wrote it in terms of either $n$ or $k$, using function notation. From the first part of the problem we have a relationship between $n$ and $k$; from here it is a matter of algebraic manipulation.

As a rule of thumb for turning text into symbols, you should have written down at least one new piece of information every time the word "of" appears. And usually it appears quite often. Every time a pronoun appears (especially the "missable" ones like "one" and "other" and sometimes "that") you should hunt to figure out what thing it's referencing; it is probably something else to write down.

[[I think a very reasonable question is how I knew what to do when I got to "as". I can't really say why I knew that this was the end of the "Express… as" clause. However, had I not put the equals sign there, I would have immediately known I had done something wrong, because when the "function" came up, there would be nowhere in the expression to put it.

So then I would have to read it carefully again until I realized that was because I needed the equals sign. This seems like a more practical approach: if you're not sure where something goes, it might be because you missed a thing; reread it.]]

-
Beat me to it! Great explanation! – Jeel Shah Jun 24 '14 at 6:26
@gekkostate: Thanks! I hope I didn't just waste your last 20 minutes writing though :/ – Eric Stucky Jun 24 '14 at 6:27
haha nope! I was doing the write up (5 mins, tops) and then I saw your answer and I was like "well, this one does it better than mine!". – Jeel Shah Jun 24 '14 at 6:28
Very well done! You could have continued with "$n^2+2k^2=f(n)$ or $n^2+2k^2=f(k)$, find $f$". – Yves Daoust Jun 24 '14 at 6:31
@Yves: Ah, that is actually a good point. Editing now. Ah, and it even gives me a chance to unpack one of the last "of"s ;) – Eric Stucky Jun 24 '14 at 6:33

Let the two numbers be $x$ and $y$. Then $x+y=1$. We need to express $g(x,y)=x^2+2y^2$ as a function of one of the numbers. If you want it to be a function of $x$ then, substitute $y=1-x$ in $g(x.y)$ will lead $g(x,1-x)=x^2+2(1-x)^2$. Call $f(x)=g(x,1-x)$. Then $f(x) = x^2+2(1-x)^2$.

If you want it to be a function of $y$, then $g(y) = (1-y)^2+2y^2$

-

First we write up the constraints described in the first sentence:

$x,y \geq 0$

$x+y=1$

The second sentence asks us for the 'sum of the square of one and twice the square of the other' - i.e. $x^2 +2y^2$. However the final caveat was to express this as a function of only one of the numbers, so we use the constraint given to us to express $y$ as a function of $x$ (or the other way around of course):

$y=1-x$

$f(x)= x^2 +2y^2 = x^2 + 2(1-x)^2$

-