Step 1: Reinforce the pants
Get a small piece of sturdy woven fabric and cut a backing piece. This should be about an inch or an inch & a half on each side, and cut diagonally, so that the edges will not ravel.
Pin this to the back of your pants, over the area where the hole is.
Using thread that matches the pants (or highly contrasting thread if you prefer), stitch around the hole, avoiding the pins, then back and forth across the torn area. Use the sewing machine's reverse function, angling the line slightly each pass, so that each line of stitching is a millimeter or two apart. When you've done one direction, turn the pants 90 degrees and do a second pass. You should end up with some stitching that looks like cross-hatching, and the hole will hardly be visible any more. The last pictures show this but they are sadly blurry (my apologies).