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]

{(Subscript[x, 1]), (Subscript[x, 2])} = x /. solution1

Once we obtain the two solutions, we check them.

{(Subscript[x, 1]), (Subscript[x, 2])} + 1/{(Subscript[x, 1]), (Subscript[x, 2])}

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

Simplify[%]

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]

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]

n = 25 - d

10  d  + 5 n

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}]

We can refer to the previous output with %.

{x^2  +  y^2  +  z == 0, 
        3  x + 4  y == 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[%]