Solution (source code)

= Solution

\b[Measure cantilever torsion with the lateral channel of a four-quadrant optical detector.] An in-plane surface displacement perpendicular to the cantilever axis twists the cantilever. The reflected laser spot moves sideways, so the left-minus-right detector signal, demodulated at $\omega$ by a <lock-in amplifier>, gives the amplitude and phase of the lateral piezoresponse. The top-minus-bottom signal primarily records bending.

Displacement along the cantilever axis can instead cause buckling and leak into the nominally vertical channel. Rotate the specimen by $90^\circ$ and repeat the measurement to sample the other in-plane component; use a reference specimen and sensitivity calibration before converting a voltage into displacement or force. A torsional spring constant and lever-arm calibration are additionally needed for an actual lateral-force value. Thus \b[lateral piezoresponse is not automatically a calibrated force measurement].