Treat the ladder as a uniform slender rigid body. While both contacts remain imposed, its centre of mass is , with speed . Its central moment of inertia is . Adding translational and rotational kinetic energy gives
Taking the floor as zero gravitational potential energy, the Lagrangian, conjugate momentum and Euler-Lagrange equation are
The positive sign is appropriate: gravity increases the angle from the vertical. These are the constrained equations of a frictionless sliding ladder. Real wall contact is unilateral: a wall cannot pull the ladder. Once the computed normal force would become negative, the two-contact model ceases to apply; the question explicitly assumes that contact persists.