Question 4012
Let G = number of gold coins and S = number of silver coins.

(1)  G + S = 42   Total number of coins in the bag.

(2)  G(8 gms) + S(5 gms) = 246 gms.  Total weight of coins.

 Rewrite (1) as  G = 42 - S  and substitute this for G in (2).

 (2a)  (42 - S)(8 gms) + S(5gms) = 246 gms.     Solve for S.

          336 - 8S + 5S = 246
               336 - 3S = 246   Subtract 336 from both sides.
                    -3S = -90   Divide both sides by -3
                      S = 30    The number of silver coins.

                     G = 42 - S
                     G = 42 - 30
                     G = 12       The number of gold coins. 

Check:  G + S = 12 + 30 = 42  The total number of coins.
        G(8 gms) + S(5 gms) = 246 gms
        12(8) + 30(5) = 96 + 150 = 246 gms.  The total weight of the coins.