David walked 19 kilometers. The first part of the walk was at 5kph and the rest at 3kph. he would have covered 2 kilometers less if he had reversed the rates, that is, if he had walked at 3kph and at 5kph for the same times that he actually walked at 5kph and 3kph, respectively. How long did it take him to walk the 19 kilometers?

Let T1 (in hours) be the time of the first part of the walk and T2 be the time of the second part.

5 T1 + 3 T2 = 19 (km)
3 T1 + 5 T2 = 17 (km)

Solve those two equations for T1 and T2.

15 T1 + 9 T2 = 57
15 T1 + 25 T2 = 85
16 T2 = 28 etc. That tells you T1. Then solve for T2

T1 + T2 is the total time that it took.

The 16 T2 = 28 equation tells you that T2 = 1.75 hours

Therefore 5T1 + 5.25 = 19
T1 = 2.75 hours

Total time = 4.5 hours

To find the time it took for David to walk the 19 kilometers, we can set up an equation based on the given information.

Let's assume that David spent t1 hours walking at 5kph and t2 hours walking at 3kph.

Using the formula Distance = Speed × Time, we can write the equation for the first part of the walk:
5t1 = distance1

And for the second part of the walk:
3t2 = distance2

We know that David walked a total distance of 19 kilometers, so:
distance1 + distance2 = 19

Substituting the equations for distance1 and distance2:
5t1 + 3t2 = 19

According to the information given, if David reversed the rates, the distance traveled would be 2 kilometers less. In that case, the equation would be:
3t1 + 5t2 = 19 - 2 = 17

Now we have a system of two equations:

5t1 + 3t2 = 19
3t1 + 5t2 = 17

To solve this system of linear equations, we can use the method of substitution or elimination. Let's solve it using the method of elimination:

Multiply the first equation by 3 and the second equation by 5 to eliminate t1 or t2:
15t1 + 9t2 = 57
15t1 + 25t2 = 85

Now subtract the first equation from the second equation:
(15t1 + 25t2) - (15t1 + 9t2) = 85 - 57
25t2 - 9t2 = 28
16t2 = 28
t2 = 28/16
t2 = 7/4

So, David spent t2 = 7/4 hours walking at 3kph.

To find t1, substitute the value of t2 into one of the original equations:
5t1 + 3(7/4) = 19
5t1 + 21/4 = 19
5t1 = 19 - 21/4
5t1 = (76 - 21)/4
5t1 = 55/4
t1 = 55/4 * 1/5
t1 = 11/4

Thus, David spent t1 = 11/4 hours (or 2.75 hours) walking at 5kph.

Therefore, the total time it took him to walk the 19 kilometers is:
Total time = t1 + t2 = 11/4 + 7/4 = 18/4 = 4.5 hours.

So, it took David 4.5 hours to walk the 19 kilometers.