# How to find a QR decomposition using Givens' Rotations

I am trying to write a program that finds a QR factorization for an $$m$$x$$n$$ matrix $$A$$. I decided to use Givens' rotations to calculate the QR factorization, but i'm a bit confused on the procedure. I looked at the wikipedia example and this question, but the wikipedia article only has one example (and it uses a square matrix instead of a rectangular matrix), and I found the answer to the question a bit hard to follow. If anyone could give me some guidance on how to do this procedure, it would be greatly appreciated. Thanks!

(Edit: Also, I know I could use Gram-Schmidt instead of Givens' rotations, but I want to use Givens' rotations as a challenge)

• What specifically do you need to do? Your title asks about finding the null space, but you want to find the $QR$ factorisation Commented Nov 11, 2021 at 19:10
• Gram-Schmidt decomposition is probably much easier to program than other methods, but according to Wikipedia it is numerically unstable. You are probably not writing for a professional application however, so this I expect this isn't important Commented Nov 11, 2021 at 19:12
• @FShrike sorry I had a rough draft of the question beforehand and forgot to change the title. My ultimate goal is to find the null space using QR factorization, but before that, I need to get the QR factorization part working. Also while I could use the Gram-Schmidt algorithm for this, I want to use Givens' rotations as a challenge. This is kind of a for-fun-and-learning type project. I just changed the title to clarify my question. Commented Nov 11, 2021 at 19:31