This document provides an introduction to pair trading based on cointegration. It discusses that pair trading selects two highly correlated stocks and trades their price differences. Cointegration refers to the long-term co-movement of stock prices, which pair trading exploits. The document outlines the basic idea of pair trading when stock prices diverge, and simulates pair trading using R language to estimate spreads, check for cointegration, generate signals, and backtest performance. In summary, pair trading is a quantitative strategy that aims to profit from mean reversion of cointegrated stock price spreads.