Kneel down on the floor beside the bare area, and look at the underlying subfloor. You will see two wooden tack strips at the location where the wall edges were. Insert a pry bar under the strips, and pry them up from the floor. If the floor is concrete, this takes quite a bit of force.
Cut the edges of the carpet surrounding the area using a straight edge and utility knife to trim them into a square or rectangular shape.
Measure the interior of the square or rectangle using a tape measure, and cut a piece of carpet padding to the same size.
Apply double-sided carpet seaming tape to the entire perimeter of one side of the padding, and insert it into the hole. Press the pad firmly against the floor.
Place the carpet remnant over the repair site, so that it extends at least one-half inch onto the good carpet on all sides. Use the straight edge and a utility knife to cut around the entire perimeter of the remnant, so that you trim the remnant and the underlying carpet. This cutting method ensures a snug fit at all seams.
Turn the carpet patch over so that the back faces up, and apply carpet seam tape to the entire perimeter. Flip it over, and press it on top of the carpet pad. Smooth the edges with your hands to blend the carpet fibers together to disguise the seams.