The coins differ in value by 5¢, so swapping the numbers of them will change the value by 5¢ for each unit difference in the numbers of coins. Since 40¢ = 8 * 5¢ there must be 8 more dimes than nickels.
There are (22 +8)/2 = 15 dimes and 7 nickels.
_____ You could write some equations for this problem. Let n, d represent numbers of nickels and dimes. .. n +d = 22 .. 10d +5n - (10n +5d) = 40 . . . . . . . cents .. 5(d -n) = 40 . . . . . . . . . . . . . . . . . . reversing the coin count changes the total by 5 cents for each unit of difference (d -n), as stated above. .. d -n = 8 . . . . . . . . . . . . . . . . . . . . . . divide the preceding equation by 5 Adding this last equation to the first gives .. 2d = 22 +8 .. d = 30/2 = 15 .. n = 22 -15 = 7 There are 15 dimes and 7 nickels.
I can't really show my work here, sorry. I hope this helped some though. Look at an app called photo math it can show you the steps and explain the problem.
You were going in the right direction but the problem was that you needed to subtract and not add. The formula should be y-y1 / x-x1 iirc. Hope this helped.