Use a utility knife to cut around the damaged area. Move the carpet threads away from the cutting area so that you’re only cutting the backing, not the threads.
Get a spare piece of carpet, or find a place – such as a closet – where a missing piece will go unnoticed. Use the damaged piece that you’ve just cut out as a template, and cut a piece of the undamaged carpet of the same size.
Apply double-faced carpet tape to the perimeter of the cutout and peel the paper backing strip off the top of the tape.
Press the new patch into place. You can use a rolling pin for this.
Weigh the patch down for several hours with heavy objects, such as books, then brush the carpet nap along the seam so that it blends together.