The present work is devoted to extension of the trapezoidal rule in the space W (2,1) 2. The optimal quadrature formula is obtained by minimizing the error of the formula by coefficients at values of the first derivative of an integrand. Using the discrete analog of the operator d 2 dx 2 − 1 the explicit formulas for the coefficients of the optimal quadrature formula are obtained. Furthermore, it is proved that the obtained quadrature formula is exact for any function of the set F = span{1, x, e x , e −x }. Finally, in the space W (2,1) 2 the square of the norm of the error functional of the constructed quadrature formula is calculated. It is shown that the error of the obtained optimal quadrature formula is less than the error of the Euler-Maclaurin quadrature formula on the space L (2) 2 .