In this study, a reproducing kernel Hilbert space method with the Chebyshev function is proposed for approximating solutions of a second-order linear partial differential equation under nonhomogeneous initial conditions. Based on reproducing kernel theory, reproducing kernel functions with a polynomial form will be erected in the reproducing kernel spaces spanned by the shifted Chebyshev polynomials. The exact solution is given by reproducing kernel functions in a series expansion form, the approximation solution is expressed by an n-term summation of reproducing kernel functions. This approximation converges to the exact solution of the partial differential equation when a sufficient number of terms are included. Convergence analysis of the proposed technique is theoretically investigated. This approach is successfully used for solving partial differential equations with nonhomogeneous boundary conditions.