We provide a criterion to compute the Malgrange pseudogroup, the nonlinear analog
of the differential Galois group, for classes of second order differential equations. Let
be the differential Galois
groups of their
-th
variational equations along an algebraic solution
. We show that if the
dimension of one of the
is large enough, then the Malgrange pseudogroup is known. This in turn proves the
irreducibility of the original nonlinear differential equation. To make the criterion
applicable, we give a method to compute the dimensions of the variational Galois groups
via
constructive reduced form theory. As an application, we reprove the irreducibility of
the second and third Painlevé equations for special values of their parameter. In the
appendices, we recast the various notions of variational equations found in the
literature and prove their equivalences.