Help to solve math problem

dboxall123

New member
Joined
Jan 11, 2014
Messages
3
Hello everyone! I'm trying to work out a puzzle that is part of a programming challenge.

Now, I'm not asking for help with the programming part, I can do that. My math skills just aren't good enough to work out how to do something like this. I've sat down with a pen, a piece of paper and a calculator, and I really can't work out how I would find the value of these shapes. If someone could offer me some advice on how to work this out with a calculator and a pen, I would be most grateful.

Thanks in advance,
Dan

ps: Apologies if I have put this in the wrong section, but I really have no idea what sort of method I will have to use, so I took a guess.


(Click thumbnail for larger image)

Programming.JPG
 
Last edited by a moderator:
This is an exercise in solving a linear system. The easiest method of solution I can think of for a computer (assuming a unique solution always exists) is using some basic linear algebra. The first entry of each row will be how many stars in that row, the second the number of hearts, etc.

1) Write a function invert(A) which finds the inverse of the 5x5 matrix A. One method would be using the standard algorithm for the inverse by row reduction, another by means of the adjoint.

\(\displaystyle A = \left[\begin{array}{ccccc}
1 &1 &1& 1& 0\\
1 &0 &2 &1 &0\\
2 &1 &0 &1 &0\\
1 &0 &2 &0 &1\\
1 &0& 3 &0 &0 \end{array}\right] \longrightarrow
\text{invert}(A) = \left[\begin{array}{ccccc}
-.75 &0 &.75& 0& .25\\
1.25 &-1 &-.25 &0 &.25\\
.25 &0 &-.25 &0 &.25\\
.25 &-1 &-.25 &0 &-.75\\
.25 &0& -.25 &1 &-.75 \end{array}\right]\)

2) Multiply the matrix invert(A) on the right by the column vector, in this case (1134, 1346, 1630, 1111, 1168)^T


\(\displaystyle \left[\begin{array}{ccccc}
-.75 &0 &.75& 0& .25\\
1.25 &-1 &-.25 &0 &.25\\
.25 &0 &-.25 &0 &.25\\
.25 &-1 &-.25 &0 &-.75\\
.25 &0& -.25 &1 &-.75 \end{array}\right] \left[\begin{array}{c}1434\\1346\\1630\\1111\\1168 \end{array} \right] = \left[ \begin{array}{c} 439 \\ ? \\ ? \\ ? \\ ? \end{array} \right] \)

Notice the bottom row isn't even necessary... In this case, I came up with, for example, Star=439.

Another method is just to apply standard Gaussian row reduction to the linear system. This shouldn;t take more than a fraction of a second following standard algorithms (google!)
 
Last edited:
Thank you very much for this, this is exactly what I wanted. I of course would have just googled it in the first place, but I had no idea what to google lol. Now at least I have a jumping-off point. Just gotta work out what any of this means. Time for some serious Googling :D.

Thanks again,
-Dan
 
Top