On Tue, Feb 26, 2008 at 2:29 AM,  <grandmabeckie / msn.com> wrote:
> I am try to help my daughter:
>  Problem
>
>  father is 4 times older then his daughter.
>  in 6 years he will be 3 times older what is the answer and how did you
>  reach it.
>  Thanks, a mom in CA

Here's a matrix solution...

require 'matrix'
coefficient_matrix = Matrix[[1, -4], [1, -3]]
solution_vector = [[0], [12]]
father_age, daughter_age = (coefficient_matrix.inverse *
solution_vector).to_a.flatten

=> [48, 12]

Let x be father's age, y be daughter's

x = 4y
x + 6 = 3(y + 6)

Simplified and with x's and y's on one side.

x - 4y = 0
x - 3y = 12

The coefficients make up the matrix [[1, -4], [1, -3]], with the
current solution vector as [[0], [12]].

Multiply both sides by the inverse of the coefficient matrix will give
you the identity matrix on the left side and the solution vector on
the right.

cheers,
Todd