Johnny's average speed in traffic was 25 miles per hour.
The Breakdown
Assuming that Johnny's average speed in traffic was "x" miles per hour. Since he drove 25 miles in traffic, the time spent in traffic can be calculated as 25/x hours.
After the traffic cleared, Johnny was able to drive 27 miles per hour faster than his speed in traffic. So, his speed after the traffic cleared would be (x + 27) miles per hour. He drove another 104 miles at this speed, which took him 104/(x + 27) hours.
The total time for the trip is given as 3 hours. Therefore, the sum of the time spent in traffic and the time spent after the traffic cleared should equal 3 hours:
25/x + 104/(x + 27) = 3
To solve this equation, we can multiply through by x(x + 27) to eliminate the denominators:
25(x + 27) + 104x = 3x(x + 27)
Simplifying the equation:
25x + 675 + 104x = 3x² + 81x
Combining like terms:
0 = 3x² + 81x - 129x - 675
0 = 3x² - 48x - 675
Now, we can solve this quadratic equation using quadratic formula.
x = (-b ± √(b^2 - 4ac)) / (2a)
For our equation, a = 3, b = -48, and c = -675. Plugging these values into the quadratic formula:
x = (-(-48) ± √((-48)² - 4 × 3 × -675)) / (2 × 3)
Simplifying further:
x = (48 ± √(2304 + 8100)) / 6
x = (48 ± √10404) / 6
x = (48 ± 102) / 6
Now, we have two possible solutions for x:
x1 = (48 + 102) / 6 = 150 / 6 = 25
x2 = (48 - 102) / 6 = -54 / 6 = -9
Since speed cannot be negative, we discard the negative solution. Therefore, Johnny's average speed in traffic was 25 miles per hour.