# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
398 lines (366 sloc) 22.5 KB
 Age word problems
randRange(1, 10) randRangeExclude(1, 10, [I1]) person(I1) person(I2) personVar(I1) personVar(I2)
randRange(3, 5) randRange(2, 20) randRange(1, 10) * (C - 1)

{P1 is A years older than P2| P2 is A years younger than P1}. {For the last {four|3|two} years, P1 and P2 have been friends.| P1 and P2 first met {four|3|two} years ago.|} CardinalThrough20(B) years ago, P1 was C times as old as P2.

How old is P1 now?

(C * (B + A) - B) / (C - 1)

The information in the first sentence can be expressed in the following equation:

\blue{V1 = V2 + A}

$(".first").addClass("hint_blue"); CardinalThrough20(B) years ago, P1 was V1 - B years old, and P2 was V2 - B years old. The information in the second sentence can be expressed in the following equation: \red{V1 - B = C(V2 - B)}$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

Because we are looking for V1, it might be easiest to solve our first equation for V2 and substitute it into our second equation.

Solving our first equation for V2, we get: \blue{V2 = V1 - A}. Substituting this into our second equation, we get the equation:

\red{V1 - B = C(} \blue{(V1 - A)}\red{ - B)}

which combines the information about V1 from both of our original equations.

Simplifying the right side of this equation, we get: V1 - B = CV1 - C * (A + B).

Solving for V1, we get: C - 1 V1 = C * (A + B) - B.

V1 = (C * (B + A) - B) / (C - 1).

How old is P2 now?

(A - B + C * B) / (C - 1)

We can use the given information to write down two equations that describe the ages of P1 and P2.

Let P1's current age be V1 and P2's current age be V2.

The information in the first sentence can be expressed in the following equation:

\blue{V1 = V2 + A}

$(".first").addClass("hint_blue"); CardinalThrough20(B) years ago, P1 was V1 - B years old, and P2 was V2 - B years old. The information in the second sentence can be expressed in the following equation: \red{V1 - B = C(V2 - B)}$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

Because we are looking for V2, it might be easiest to use our first equation for V1 and substitute it into our second equation.

Our first equation is: \blue{V1 = V2 + A}. Substituting this into our second equation, we get the equation:

\blue{(V2 + A)}\red{-B = C(V2 - B)}

which combines the information about V2 from both of our original equations.

Simplifying both sides of this equation, we get: V2 + A - B = C V2 - C * B.

Solving for V2, we get: C - 1 V2 = A - B + C * B.

V2 = (A - B + C * B) / (C - 1).

randRange(3, 5) randRange(2, 10) * (C - 1)

P1 is C times as old as P2 and is also A years older than P2.

How old is P1?

A * C / (C - 1)

\blue{V1 = CV2}

\red{V1 = V2 + A}

$(".first").addClass("hint_blue");$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

One way to solve for V1 is to solve the second equation for V2 and substitute that value into the first equation.

Solving our second equation for V2, we get: \red{V2 = V1 - A}. Substituting this into our first equation, we get the equation:

\blue{V1 = C}\red{(V1 - A)}

which combines the information about V1 from both of our original equations.

Simplifying the right side of this equation, we get: V1 = CV1 - C * A.

Solving for V1, we get: C - 1 V1 = A * C.

V1 = A * C / (C - 1).

How old is P2?

A / (C - 1)

We can use the given information to write down two equations that describe the ages of P1 and P2.

Let P1's current age be V1 and P2's current age be V2.

We can use the given information to write down two equations that describe the ages of P1 and P2.

Let P1's current age be V1 and P2's current age be V2.

\blue{V1 = CV2}

\red{V1 = V2 + A}

$(".first").addClass("hint_blue");$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

Since we are looking for V2, and both of our equations have V1 alone on one side, this is a convenient time to use elimination.

Subtracting the second equation from the first equation, we get:

0 = \blue{CV2} -\red{(V2 + A)}

which combines the information about V2 from both of our original equations.

Solving for V2, we get: C - 1 V2 = A.

V2 = A / (C - 1).

randRange(2, 5) randRange(A + 2, 9) randRange(2, 7) * (C - A)

P1 is A times as old as P2. B years ago, P1 was C times as old as P2.

How old is P1 now?

A * B * (C - 1) / (C - A)

The information in the first sentence can be expressed in the following equation:

\blue{V1 = AV2}

$(".first").addClass("hint_blue"); CardinalThrough20(B) years ago, P1 was V1 - B years old, and P2 was V2 - B years old. The information in the second sentence can be expressed in the following equation: \red{V1 - B = C(V2 - B)}$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

Because we are looking for V1, it might be easiest to solve our first equation for V2 and substitute it into our second equation.

Solving our first equation for V2, we get: \blue{V2 = \dfrac{V1}{A}}. Substituting this into our second equation, we get:

\red{V1 - B = C (}\blue{\frac{V1}{A}} \red{- B)}

which combines the information about V1 from both of our original equations.

Simplifying the right side of this equation, we get: V1 - B = fractionReduce(C, A) V1 - C * B.

Solving for V1, we get: fractionReduce(C - A, A) V1 = B * (C - 1).

V1 = fractionReduce(A, C - A) \cdot B * (C - 1) = A * B * (C - 1) / (C - A).

How old is P2 now?

B * (C - 1) / (C - A)

We can use the given information to write down two equations that describe the ages of P1 and P2.

Let P1's current age be V1 and P2's current age be V2.

The information in the first sentence can be expressed in the following equation:

\blue{V1 = AV2}

$(".first").addClass("hint_blue"); CardinalThrough20(B) years ago, P1 was V1 - B years old, and P2 was V2 - B years old. The information in the second sentence can be expressed in the following equation: \red{V1 - B = C(V2 - B)}$(".second").addClass("hint_red");

Now we have two independent equations, and we can solve for our two unknowns.

Because we are looking for V2, it might be easiest to use our first equation for V1 and substitute it into our second equation.

Our first equation is: \blue{V1 = AV2}. Substituting this into our second equation, we get:

\blue{AV2} \red {-B = C(V2 - B)}

which combines the information about V2 from both of our original equations.

Simplifying the right side of this equation, we get: A V2 - B = C V2 - B * C.

Solving for V2, we get: C - A V2 = B * (C - 1).

V2 = B * (C - 1) / (C - A).

randRange(3, 20) randRange(7, 24) * (A - 1)

In B years, P1 will be A times as old as he is right now.

In B years, P1 will be A times as old as she is right now.

How old is he right now?

How old is she right now?

B / (A - 1)

We can use the given information to write down an equation about P1's age.

Let P1's age be V1.

In B years, he will be V1 + B years old.

In B years, she will be V1 + B years old.

At that time, he will also be A V1 years old.

At that time, she will also be A V1 years old.

Writing this information as an equation, we get:

V1 + B = A V1

Solving for V1, we get: A - 1 V1 = B.

V1 = B / (A - 1).

randRange(3, 5) randRange(1, 10) * (C - 1) randRange(C * B + 1, 15) * (C - 1)

P1 is A years old and P2 is B years old.

How many years will it take until P1 is only C times as old as P2?

(A - B * C) / (C - 1)

We can use the given information to write down an equation about how many years it will take.

Let y be the number of years that it will take.

In y years, P1 will be A + y years old and P2 will be B + y years old.

At that time, P1 will be C times as old as P2.

Writing this information as an equation, we get:

A + y = C (B + y)

Simplifying the right side of this equation, we get: A + y = C * B + C y.

Solving for y, we get: C - 1 y = A - C * B.

y = (A - C * B) / (C - 1).

We can use the given information to write down two equations that describe the ages of P1 and P2.

Let P1's current age be V1 and P2's current age be V2.