The R-function theory and least square method are employed to solve the torsion problem of the bar with H-shaped cross-section. When the least square method is used to solve the elastic torsion problem alone, the stress function can be set to meet the boundary condition, only with the simple cross-section such as the rectangle and ellipse. For the H-shaped cross-section, it is hard to find a stress function to meet the boundary condition. The R-function theory can solve the problem, and it can be used to describe H-shaped cross-section by implicit function form. Introducing the R-function theory can be easy to construct the stress function that satisfied the boundary of H-shaped cross-section. A numerical example demonstrates the feasibility and efficiency of the present method.