In this paper, we present a new methodology, based on the inverse problem approach, for the determination of an unknown shear force acting on the inaccessible tip of the microcantilever, which is a key component of transverse dynamic force microscopy (TDFM). The mathematical modelling of this phenomenon leads to the inverse problem of determining the shear force g(t) acting on the inaccessible boundary x = l in a system governed by the variable coefficient Euler-Bernoulli equation r(A)(x)u(tt) + mu(x)u(t) + (r(x)u(xx) + kappa(x)u(xxt))(xx) = 0, (x, t) is an element of (0, l) x (0, T), subject to the homogeneous initial conditions and the boundary conditions u(0, t) = u(0)(t), u(x)(0, t) = 0, (u(xx)(x, t) + kappa(x)u(xxt))(x=l) = 0, (-(r(x)u(xx) + kappa(x)u(xxt))x)(x=l) = g(t), from the final time measured output (displacement) u(T) (x) := u( x, T). We introduce the input-output map (Phi g)(x) := u( x, T; g), g is an element of G, and prove that it is a compact and Lipschitz continuous linear operator. Then we introduce the Tikhonov functional J(F) = 1/2 parallel to Phi g - u(T)parallel to(2)(L2(0,l)) and prove the existence of a quasi-solution of the inverse problem. We derive a gradient formula for the Frechet gradient of the Tikhonov functional through the corresponding adjoint problem solution and prove that it is a Lipschitz continuous functional. The results of the numerical experiments clearly illustrate the effectiveness and feasibility of the proposed approach.