A new square-root algorithm for Kalman filtering and smoothing is derived. The new algorithm is a modification of the information filter presented by Paige and Saunders [C.C. Paige and M.A. Saunders, Least Squares Estimation of Discrete Linear Dynamic System Using Orthogonal Transformations, SIAM J. Num.Anal 12 (1977) pp. 180-193] and can be used when the input covariance matrices are diagonal. Potential ill-conditioning, caused by different sizes of the input covariances, is handled using techniques for solving weighted and constrained least squares problems. That is, the ordinary QR-decomposition that is used in the filter by Paige and Sauders are replaced by a weighted QR-decomposition introduced by Gulliksson and Wedin [M.G. Gulliksson and P.-Å. Wedin, Modyfying the QR Decomposition to Weighted and Constrained Linear Least Squares, SIAM J. Mat.Anal. 13 (1992) pp. 1298-1313]. This technique implies that the new algorithm can handle singular covariance matrices as well as singular information matrices.