To find the distance a spring is compressed by an object under kinetic friction, the equation x = (W - μkN) / k is used, where W is the object's weight, μk is the coefficient of kinetic friction, N is the normal force, and k is the spring constant. The normal force can be calculated as N = mg, with m being the object's mass and g the acceleration due to gravity. The weight is determined by multiplying the mass by gravity. This equation applies only when the object is in motion; if at rest, static friction must be considered instead. Ultimately, understanding these dynamics allows for accurate calculations of spring compression in the presence of friction.