Activity 9

Prepared by Jarrod Brown, UMass Lowell

•1. Find two numbers such that the sum of each and its reciprocal is 17/5.

Solution: Let x be a number.   First, we will solve the following equation for x.

solution1 = Solve[x + (1/x) == 17/5, x]

{{x -> 1/10 (17 - 3 21^(1/2))}, {x -> 1/10 (17 + 3 21^(1/2))}}

{x _ 1, x _ 2} = x /. solution1

{1/10 (17 - 3 21^(1/2)), 1/10 (17 + 3 21^(1/2))}

Once we obtain the two solutions, we check them.

{x _ 1, x _ 2} + 1/{x _ 1, x _ 2}

{10/(17 - 3 21^(1/2)) + 1/10 (17 - 3 21^(1/2)), 10/(17 + 3 21^(1/2)) + 1/10 (17 + 3 21^(1/2))}

These expressions are not clearly equal to 17/5 but we can simplify them.

Simplify[%]

{17/5, 17/5}

•2. A collection of 25 coins is worth $2.10. If the coins are  nickels and dimes, how many of each coin are in the collection ?

Solution:

solution2 = Solve[10 d + 5 (25 - d) == 210, d]

{{d -> 17}}

The previous step indicates that the number of dimes should be 17 and the number of nickels is 25 - d = 25 - 17 = 8.

There is only one solution, but Mathematica outputs a list of solutions nevertheless.  In the next calculation we use First to extract the first, and only, solution.

d = d /. First[solution2]

17

n = 25 - d

8

10 d + 5 n

210

•Comments

The Mathematica function Solve gives solutions in the form of a list of solutions, with each solution being a list of rules.  The expectation is that if one makes the substitutions indicated by the rules, the equation(s) given is Solve will be true.

Here is a system of equations with two solutions in terms of z.

Solve[{x^2 + y^2 + z == 0, 3 x + 4 y == 5}, {x, y}]

{{x -> 1/5 (3 - 4 (-z - 1)^(1/2)), y -> 1/5 (3 (-z - 1)^(1/2) + 4)}, {x -> 1/5 (4 (-z - 1)^(1/2) + 3), y -> 1/5 (4 - 3 (-z - 1)^(1/2))}}

We can refer to the previous output with %.

{x^2 + y^2 + z == 0, 3 x + 4 y == 5} /. %

( 1                      2   1                      2            3                        4    ... ) == 5   25                         25                                  5                        5

The first row of the output above contain the equations obtained by substituting the first solution in to our equations. The second row is produced from the second solution.  We need to ask Mathematica to simplify.

Simplify[%]

( True   True )    True   True


Converted by Mathematica  (May 14, 2003)