Let:
x = Length of the short loop
y = Length of the long loop
Joel ran 3 short loops and 4 long loops, the total distance was 30mi, so:

He also ran 2 short loops and 6 long loops, the total distance was 40mi, so:

From (1) solve for x:

Replace (3) into (2):

Replace y into (3):

Answer:
The short loop has a length of 2 miles
The long loop has a length of 6 miles