That’s an easy answer. Fly a heading exactly opposite of that used for takeoff. Without doing any math, just look at the number shown at the bottom of the heading indicator when you’re aligned with the runway. That’s the heading you’ll fly on the downwind.
This provides for a symmetrical, rectangular traffic pattern, instead of one having the shape of an enormous amoeba.