{"id":622,"date":"2025-12-03T08:15:57","date_gmt":"2025-12-03T07:15:57","guid":{"rendered":"https:\/\/clases.jesussoto.es\/?p=622"},"modified":"2025-12-01T22:28:00","modified_gmt":"2025-12-01T21:28:00","slug":"alg-factorizacion-qr","status":"publish","type":"post","link":"https:\/\/clases.jesussoto.es\/?p=622","title":{"rendered":"ALG: Factorizaci\u00f3n QR"},"content":{"rendered":"<p>La Factorizaci\u00f3n QR (o Descomposici\u00f3n QR) es un proceso por el cual una matriz \\(A\\) se expresa como el producto de dos matrices especiales: una matriz <strong>ortogonal<\/strong> \\(Q\\) y una matriz <strong>triangular superior<\/strong> \\(R\\).<\/p>\n<p>Formalmente, para una matriz \\(A\\) de tama\u00f1o \\(m \\times n\\) (donde asumimos que las columnas de \\(A\\) son linealmente independientes, y usualmente \\(m \\ge n\\)), la descomposici\u00f3n es:<\/p>\n<p>\\[ A = QR \\]<\/p>\n<p>La matriz \\(Q\\) es una matriz de tama\u00f1o \\(m \\times n\\) cuyas columnas \\(\\{\\mathbf{q}_1, \\mathbf{q}_2, \\ldots, \\mathbf{q}_n\\}\\) forman un conjunto <strong>ortonormal<\/strong>. Esto significa que:<\/p>\n<ol>\n<li><strong>Normalidad<\/strong>: Cada columna es un vector unitario, es decir, tiene norma 1:<br \/>\n    \\[ \\| \\mathbf{q}_i \\| = 1 \\]<\/li>\n<li><strong>Ortogonalidad<\/strong>: El producto escalar de cualquier par de columnas distintas es cero:<br \/>\n    \\[ \\mathbf{q}_i \\cdot \\mathbf{q}_j = 0 \\quad \\text{si } i \\ne j \\]<\/li>\n<\/ol>\n<p>La matriz \\(R\\) es una matriz <strong>triangular superior<\/strong> de tama\u00f1o \\(n \\times n\\). Esto quiere decir que todos los elementos situados debajo de su diagonal principal son cero.<\/p>\n<p>\\[ R = \\begin{bmatrix} r_{11} &#038; r_{12} &#038; \\cdots &#038; r_{1n} \\\\ 0 &#038; r_{22} &#038; \\cdots &#038; r_{2n} \\\\ \\vdots &#038; \\vdots &#038; \\ddots &#038; \\vdots \\\\ 0 &#038; 0 &#038; \\cdots &#038; r_{nn} \\end{bmatrix} \\]<\/p>\n<p>Veamos el procedimiento para obtener la factorizaci\u00f3n. Pero antes, refresquemos un concepto, el de componente escalar. Dados dos vectores de \\(\\mathbf{v},\\mathbf{u}\\in\\mathbb{R}^n\\) definimos la componente escalar de \\(\\mathbf{u}\\) sobre \\(\\mathbf{v}\\) como<br \/>\n\\[\\mathbf{comp}_\\mathbf{v}\\mathbf{u}=\\frac{\\mathbf{v}\\bullet\\mathbf{u}}{\\|\\mathbf{v}\\|}\\] <\/p>\n<p>En el caso de que \\(\\mathbf{v}\\) sea normal, entonces <\/p>\n<p>\\[\\mathbf{comp}_\\mathbf{v}\\mathbf{u}=\\mathbf{v}\\bullet\\mathbf{u}\\] <\/p>\n<p>Recordemos que la proyecci\u00f3n de \\(\\mathbf{u}\\) sobre \\(\\mathbf{v}\\)  es<br \/>\n\\[<br \/>\n\\mathbf{proy}_\\mathbf{v}\\mathbf{u}=(\\mathbf{v}\\bullet\\mathbf{u})\\cdot \\mathbf{v}<br \/>\n\\]<br \/>\ncuando \\(\\|\\mathbf{v}\\|=1\\).<\/p>\n<p>Comencemos ahora con el proceso para obtener la factorizaci\u00f3n \\(QR\\). Este proceso toma las columnas de \\(A:[a_{ij}]\\), \\(\\mathbf{a}_1, \\mathbf{a}_2, \\ldots, \\mathbf{a}_n\\), y las transforma en las columnas ortonormales \\(\\mathbf{q}_1, \\mathbf{q}_2, \\ldots, \\mathbf{q}_n\\) de la matriz \\(Q\\).<\/p>\n<p>El vector \\(\\mathbf{a}_k\\) se expresa como una combinaci\u00f3n lineal de los vectores ortonormales \\(\\mathbf{q}_1, \\ldots, \\mathbf{q}_k\\) que abarcan el mismo subespacio que \\(\\mathbf{a}_1, \\ldots, \\mathbf{a}_k\\):<\/p>\n<p>\\[ \\mathbf{a}_k = r_{1k} \\mathbf{q}_1 + r_{2k} \\mathbf{q}_2 + \\ldots + r_{kk} \\mathbf{q}_k \\]<\/p>\n<p>Donde los coeficientes \\(r_{ik}\\) son las entradas de la matriz \\(R\\).<\/p>\n<p>Los elementos \\(r_{ik}\\) se obtienen mediante <\/p>\n<p>\\[ r_{ik}=\\mathbf{comp}_{\\mathbf{q}_i}\\mathbf{a}_k= \\mathbf{a}_k \\bullet \\mathbf{q}_i \\]<\/p>\n<p>Y dado que \\(R\\) es triangular superior, los coeficientes para \\(i > k\\) son cero:<\/p>\n<p>\\[ r_{ik} = 0, \\quad \\text{para } i > k \\]<\/p>\n<h3>Ejemplo Pr\u00e1ctico de la Factorizaci\u00f3n QR<\/h3>\n<p>Consideremos la siguiente matriz \\(A\\). Notar\u00e1s que sus columnas son linealmente independientes, lo cual es un requisito para este tipo de factorizaci\u00f3n (cuando \\(R\\) es invertible).<\/p>\n<p>Sea la matriz \\(A\\) de tama\u00f1o \\(3 \\times 2\\):<\/p>\n<p>\\[ A = \\begin{bmatrix} 1 &#038; 0 \\\\ 1 &#038; 1 \\\\ 0 &#038; 1 \\end{bmatrix} \\]<\/p>\n<p>Sean \\(\\mathbf{a}_1 = \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix}\\) y \\(\\mathbf{a}_2 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix}\\) sus vectores columna.<\/p>\n<\/h4>\n<p>Paso 1: Obtener el primer vector ortonormal \\(\\mathbf{q}_1\\)<\/h4>\n<p>Aplicamos Gram-Schmidt al primer vector \\(\\mathbf{a}_1\\):<\/p>\n<ol>\n<li>Definimos \\(\\mathbf{v}_1 = \\mathbf{a}_1\\).<\/li>\n<li> Calculamos la norma de \\(\\mathbf{v}_1\\):<br \/>\n    \\[ \\|\\mathbf{v}_1\\| = \\sqrt{1^2 + 1^2 + 0^2} = \\sqrt{2} \\]<\/li>\n<li> Normalizamos para obtener \\(\\mathbf{q}_1\\):<br \/>\n    \\[ \\mathbf{q}_1 = \\frac{\\mathbf{v}_1}{\\|\\mathbf{v}_1\\|} = \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 1\/\\sqrt{2} \\\\ 1\/\\sqrt{2} \\\\ 0 \\end{bmatrix} \\]<\/li>\n<li>Obtenemos el primer elemento de la matriz \\(R\\), \\(r_{11}\\).<br \/>\n    \\[ r_{11} = \\mathbf{a}_1 \\bullet \\mathbf{q}_1=\\sqrt{2} \\]<\/li>\n<\/ol>\n<h4>Paso 2: Obtener el segundo vector ortonormal \\(\\mathbf{q}_2\\)<\/h4>\n<p>Ortogonalizamos el vector \\(\\mathbf{a}_2\\) respecto a \\(\\mathbf{q}_1\\):<\/p>\n<ol>\n<li>Calculamos la componente de \\(\\mathbf{a}_2\\) sobre \\(\\mathbf{q}_1\\). El resultado de este producto escalar es el elemento \\(r_{12}\\) de \\(R\\):<br \/>\n    \\[ r_{12} = \\mathbf{a}_2 \\bullet \\mathbf{q}_1 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix}^t \\cdot \\begin{bmatrix} 1\/\\sqrt{2} \\\\ 1\/\\sqrt{2} \\\\ 0 \\end{bmatrix} = 0 \\cdot \\frac{1}{\\sqrt{2}} + 1 \\cdot \\frac{1}{\\sqrt{2}} + 1 \\cdot 0 = \\frac{1}{\\sqrt{2}} \\]<\/li>\n<li>Restamos la proyecci\u00f3n de \\(\\mathbf{a}_2\\) sobre \\(\\mathbf{q}_1\\) para obtener el vector ortogonal \\(\\mathbf{v}_2\\):<br \/>\n    \\[ \\mathbf{v}_2 = \\mathbf{a}_2 &#8211; r_{12} \\mathbf{q}_1 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix} &#8211; \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1\/\\sqrt{2} \\\\ 1\/\\sqrt{2} \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix} &#8211; \\begin{bmatrix} 1\/2 \\\\ 1\/2 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} -1\/2 \\\\ 1\/2 \\\\ 1 \\end{bmatrix} \\]<\/li>\n<li>Normalizamos para obtener \\(\\mathbf{q}_2\\). Para ello, calculamos<br \/>\n    \\[ \\|\\mathbf{v}_2\\| = \\sqrt{(-1\/2)^2 + (1\/2)^2 + 1^2} = \\sqrt{1\/4 + 1\/4 + 1} = \\sqrt{3\/2}, \\]<\/p>\n<p>luego<\/p>\n<p>    \\[ \\mathbf{q}_2 = \\frac{\\mathbf{v}_2}{\\|\\mathbf{v}_2\\|} = \\frac{1}{\\sqrt{3\/2}} \\begin{bmatrix} -1\/2 \\\\ 1\/2 \\\\ 1 \\end{bmatrix} = \\begin{bmatrix} -1\/\\sqrt{6} \\\\ 1\/\\sqrt{6} \\\\ 2\/\\sqrt{6} \\end{bmatrix} \\]<\/li>\n<li>Calculamos el elemento \\(r_{22}\\) de \\(R\\):<br \/>\n    \\[ r_{22} = \\mathbf{a}_2 \\bullet \\mathbf{q}_2 =\\|\\mathbf{v}_2\\| = \\sqrt{(-1\/2)^2 + (1\/2)^2 + 1^2} = \\sqrt{1\/4 + 1\/4 + 1} = \\sqrt{3\/2} \\]<\/li>\n<\/ol>\n<p>Observar, que<br \/>\n    \\[<br \/>\n\\begin{align}<br \/>\nr_{ii} &#038;= \\mathbf{a}_i \\bullet \\mathbf{q}_i\\\\<br \/>\n&#038;= \\mathbf{a}_i \\bullet \\frac{\\mathbf{v}_i}{\\|\\mathbf{v}_i\\|}\\\\<br \/>\n&#038;(\\mbox{recordemos que }\\, \\mathbf{v}_i=\\mathbf{a}_i-\\sum_{k=1}^{i-1}r_{ki} \\mathbf{q}_{k},) \\\\<br \/>\n&#038;=\\left( \\mathbf{v}_i + \\sum_{k=1}^{i-1}r_{ki} \\mathbf{q}_{k}\\right) \\bullet \\frac{\\mathbf{v}_i}{\\|\\mathbf{v}_i\\|}\\\\<br \/>\n&#038;=\\frac{1}{\\|\\mathbf{v}_i\\|}\\left( \\mathbf{v}_i \\bullet\\mathbf{v}_i+ \\sum_{k=1}^{i-1}r_{ki} (\\mathbf{q}_{k}\\bullet\\mathbf{v}_i)\\right)  \\\\<br \/>\n&#038;(\\mbox{como}\\,\\mathbf{q}_{k}\\bullet\\mathbf{v}_i=0\\,\\forall k)\\\\<br \/>\n&#038;=\\frac{1}{\\|\\mathbf{v}_i\\|}( \\mathbf{v}_i \\bullet\\mathbf{v}_i)\\\\<br \/>\n&#038;=\\|\\mathbf{v}_i\\|  \\\\<br \/>\n\\end{align}<br \/>\n\\]<\/p>\n<h4>Paso 3: Construir las matrices \\(Q\\) y \\(R\\)<\/h4>\n<p>La matriz \\(Q\\) est\u00e1 formada por los vectores \\(\\mathbf{q}_1\\) y \\(\\mathbf{q}_2\\):<\/p>\n<p>\\[ Q = [\\mathbf{q}_1 \\mid \\mathbf{q}_2] = \\begin{bmatrix} 1\/\\sqrt{2} &#038; -1\/\\sqrt{6} \\\\ 1\/\\sqrt{2} &#038; 1\/\\sqrt{6} \\\\ 0 &#038; 2\/\\sqrt{6} \\end{bmatrix} \\]<\/p>\n<p>La matriz \\(R\\) est\u00e1 formada por los valores \\(r_{ik}\\) que calculamos:<\/p>\n<p>\\[ R = \\begin{bmatrix} r_{11} &#038; r_{12} \\\\ 0 &#038; r_{22} \\end{bmatrix} = \\begin{bmatrix} \\sqrt{2} &#038; 1\/\\sqrt{2} \\\\ 0 &#038; \\sqrt{3\/2} \\end{bmatrix} \\]<\/p>\n<\/h4>\n<p>Paso 4: La Factorizaci\u00f3n QR<\/h4>\n<p>Hemos descompuesto la matriz \\(A\\) en el producto de \\(Q\\) y \\(R\\):<\/p>\n<p>\\[ A = QR \\]<\/p>\n<p>\\[ \\begin{bmatrix} 1 &#038; 0 \\\\ 1 &#038; 1 \\\\ 0 &#038; 1 \\end{bmatrix} = \\begin{bmatrix} 1\/\\sqrt{2} &#038; -1\/\\sqrt{6} \\\\ 1\/\\sqrt{2} &#038; 1\/\\sqrt{6} \\\\ 0 &#038; 2\/\\sqrt{6} \\end{bmatrix} \\begin{bmatrix} \\sqrt{2} &#038; 1\/\\sqrt{2} \\\\ 0 &#038; \\sqrt{3\/2} \\end{bmatrix} \\]<\/p>\n<hr \/>\n<blockquote>\n<p><strong>Ejemplo:<\/strong> Determina la factorizaci\u00f3n QR de la matriz \\(\\begin{bmatrix}1&#038;2\\\\ 2&#038;1\\end{bmatrix}\\).<\/p>\n<\/blockquote>\n<p><script>\nfunction showHtmlDiv9a1() {\n  var htmlShow9a1 = document.getElementById(\"html-show9a1\");\n  if (htmlShow9a1.style.display === \"none\") {\n    htmlShow9a1.style.display = \"block\";\n  } else {\n    htmlShow9a1.style.display = \"none\";\n  }\n}\n<\/script> <\/p>\n<p><button onclick=\"showHtmlDiv9a1()\">Soluci\u00f3n:<\/button><\/p>\n<div id=\"html-show9a1\" style=\"display: none;\">\nSea \\(\\mathbf{a}_1=[1,2],\\, \\mathbf{a}_2=[2,1]\\). Tomemos \\(\\mathbf{v}_1=\\mathbf{a}_1\\), entonces<\/p>\n<p>\\[\\mathbf{q}_1=\\frac{\\mathbf{v}_1}{\\|\\mathbf{v}_1\\|}=\\frac{1}{\\sqrt{5}}[1,2]\\]<\/p>\n<p>Nuestro \\(r_{11}=\\|\\mathbf{v}_1\\|=\\sqrt{5}\\).<\/p>\n<p>Calculamos el componente de \\(\\mathbf{a}_1\\) sobre \\(\\mathbf{q}_1\\):<br \/>\n\\[<br \/>\nr_{12}=\\frac{1}{\\sqrt{5}}[1,2].[2,1]=\\frac{4}{\\sqrt{5}}<br \/>\n\\]<br \/>\nDe este modo,<br \/>\n\\[<br \/>\n\\mathbf{v}_2=\\mathbf{a}_2-r_{12}\\mathbf{q}_1=\\frac{3}{5}\\left[2,-1\\right],<br \/>\n\\]<br \/>\ny<br \/>\n\\[<br \/>\n\\mathbf{q}_1=\\frac{\\mathbf{v}_2}{\\|\\mathbf{v}_2\\|}=\\frac{1}{\\sqrt{5}}[2,-1]<br \/>\n\\]<br \/>\nPor \u00faltimo<br \/>\n\\[<br \/>\nr_{22}=\\|\\mathbf{v}_2\\|=\\sqrt{5}<br \/>\n\\]<br \/>\nYa temos para contruir las matrices:<br \/>\n\\[<br \/>\nQ=\\frac{1}{\\sqrt{5}}\\begin{bmatrix}<br \/>\n1 &#038; 2\\\\<br \/>\n2&#038; -1<br \/>\n\\end{bmatrix},\\, R=\\begin{bmatrix}<br \/>\n\\sqrt{5} &#038; \\frac{4}{\\sqrt{5}}\\\\<br \/>\n0&#038; \\frac{\\sqrt{5}}{3}<br \/>\n\\end{bmatrix}<br \/>\n\\]\n<\/p><\/div>\n<hr \/>\n<blockquote>\n<p><strong>Ejemplo:<\/strong> Determina la factorizaci\u00f3n QR de la matriz \\(\\begin{bmatrix}1 &#038; 1 &#038; 0 \\\\<br \/>\n1 &#038; 0 &#038; 1 \\\\<br \/>\n0 &#038; 1 &#038; 1\\end{bmatrix}\\).<\/p>\n<\/blockquote>\n<p><script>\nfunction showHtmlDiv9a1h() {\n  var htmlShow9a1h = document.getElementById(\"html-show9a1h\");\n  if (htmlShow9a1h.style.display === \"none\") {\n    htmlShow9a1h.style.display = \"block\";\n  } else {\n    htmlShow9a1h.style.display = \"none\";\n  }\n}\n<\/script><\/p>\n<p><button onclick=\"showHtmlDiv9a1h()\">Soluci\u00f3n:<\/button><\/p>\n<div id=\"html-show9a1h\" style=\"display: none;\">\nPaso 1: Primera columna<\/p>\n<p>&#8211; \\( \\mathbf{a}_1 = \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} \\).<br \/>\n&#8211; \\( \\mathbf{v}_1 = \\mathbf{a}_1 \\).<br \/>\n&#8211; \\( r_{11} = \\| \\mathbf{v}_1 \\| = \\sqrt{1^2 + 1^2 + 0^2} = \\sqrt{2} \\).<br \/>\n&#8211; \\( \\mathbf{q}_1 = \\frac{\\mathbf{v}_1}{r_{11}} = \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} \\).[2][3]<\/p>\n<p>Paso 2: Segunda columna<\/p>\n<p>&#8211; \\( \\mathbf{a}_2 = \\begin{bmatrix} 1 \\\\ 0 \\\\ 1 \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{12} = \\mathbf{q}_1^t \\mathbf{a}_2 = \\frac{1}{\\sqrt{2}} (1 \\cdot 1 + 1 \\cdot 0 + 0 \\cdot 1) = \\frac{1}{\\sqrt{2}} \\).<br \/>\n&#8211; \\( \\mathbf{v}_2 = \\mathbf{a}_2 &#8211; r_{12} \\mathbf{q}_1 = \\begin{bmatrix} 1 \\\\ 0 \\\\ 1 \\end{bmatrix} &#8211; \\frac{1}{\\sqrt{2}} \\cdot \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 1 \\\\ 0 \\\\ 1 \\end{bmatrix} &#8211; \\begin{bmatrix} \\frac{1}{2} \\\\ \\frac{1}{2} \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} \\frac{1}{2} \\\\ -\\frac{1}{2} \\\\ 1 \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{22} = \\| \\mathbf{v}_2 \\| = \\sqrt{ \\left( \\frac{1}{2} \\right)^2 + \\left( -\\frac{1}{2} \\right)^2 + 1^2 } = \\sqrt{ \\frac{1}{4} + \\frac{1}{4} + 1 } = \\sqrt{ \\frac{3}{2} } \\).<br \/>\n&#8211; \\( \\mathbf{q}_2 = \\frac{\\mathbf{v}_2}{r_{22}} = \\frac{1}{\\sqrt{3\/2}} \\begin{bmatrix} \\frac{1}{2} \\\\ -\\frac{1}{2} \\\\ 1 \\end{bmatrix} = \\sqrt{\\frac{2}{3}} \\begin{bmatrix} \\frac{1}{2} \\\\ -\\frac{1}{2} \\\\ 1 \\end{bmatrix} = \\begin{bmatrix} \\frac{1}{\\sqrt{6}} \\\\ -\\frac{1}{\\sqrt{6}} \\\\ \\sqrt{\\frac{2}{3}} \\end{bmatrix} \\).[3][2]<\/p>\n<p>Paso 3: Tercera columna<\/p>\n<p>&#8211; \\( \\mathbf{a}_3 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{13} = \\mathbf{q}_1^t \\mathbf{a}_3 = \\frac{1}{\\sqrt{2}} (1 \\cdot 0 + 1 \\cdot 1 + 0 \\cdot 1) = \\frac{1}{\\sqrt{2}} \\).<br \/>\n&#8211; \\( r_{23} = \\mathbf{q}_2^t \\mathbf{a}_3 = \\frac{1}{\\sqrt{6}} (0 \\cdot \\frac{1}{2} -1 \\cdot 1 + \\sqrt{\\frac{2}{3}} \\cdot 1 ) = \\frac{1}{\\sqrt{6}} (0 -1 + \\sqrt{\\frac{2}{3}} \\cdot \\sqrt{6} \/ \\sqrt{2} ) \\), <\/p>\n<p>Calculando directamente: \\[ r_{23} = \\frac{ \\mathbf{a}_3^t \\mathbf{v}_2 }{ \\| \\mathbf{v}_2 \\| } = \\frac{ 0 \\cdot \\frac{1}{2} + 1 \\cdot (-\\frac{1}{2}) + 1 \\cdot 1 }{ \\sqrt{3\/2} } = \\frac{ \\frac{1}{2} }{ \\sqrt{3\/2} } = \\frac{1}{2} \\sqrt{\\frac{2}{3}} = \\frac{1}{\\sqrt{6}} \\]<\/p>\n<p>&#8211; \\( \\mathbf{v}_3 = \\mathbf{a}_3 &#8211; r_{13} \\mathbf{q}_1 &#8211; r_{23} \\mathbf{q}_2 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix} &#8211; \\frac{1}{\\sqrt{2}} \\cdot \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} &#8211; \\frac{1}{\\sqrt{6}} \\begin{bmatrix} \\frac{1}{\\sqrt{6}} \\\\ -\\frac{1}{\\sqrt{6}} \\\\ \\sqrt{\\frac{2}{3}} \\end{bmatrix} \\).<br \/>\n&#8211; Simplificando: \\( r_{13} \\mathbf{q}_1 = \\begin{bmatrix} \\frac{1}{2} \\\\ \\frac{1}{2} \\\\ 0 \\end{bmatrix} \\), \\( r_{23} \\mathbf{q}_2 = \\frac{1}{6} \\begin{bmatrix} 1 \\\\ -1 \\\\ 2 \\end{bmatrix} = \\begin{bmatrix} \\frac{1}{6} \\\\ -\\frac{1}{6} \\\\ \\frac{1}{3} \\end{bmatrix} \\).<br \/>\n&#8211; \\( \\mathbf{v}_3 = \\begin{bmatrix} 0 \\\\ 1 \\\\ 1 \\end{bmatrix} &#8211; \\begin{bmatrix} \\frac{1}{2} \\\\ \\frac{1}{2} \\\\ 0 \\end{bmatrix} &#8211; \\begin{bmatrix} \\frac{1}{6} \\\\ -\\frac{1}{6} \\\\ \\frac{1}{3} \\end{bmatrix} = \\begin{bmatrix} -\\frac{2}{3} \\\\ \\frac{2}{3} \\\\ \\frac{2}{3} \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{33} = \\| \\mathbf{v}_3 \\| = \\sqrt{ 3 \\left( \\frac{2}{3} \\right)^2 } = \\sqrt{ 3 \\cdot \\frac{4}{9} } = \\sqrt{ \\frac{4}{3} } = \\frac{2}{\\sqrt{3}} \\).<br \/>\n&#8211; \\( \\mathbf{q}_3 = \\frac{\\mathbf{v}_3}{r_{33}} = \\frac{3}{2} \\begin{bmatrix} -\\frac{2}{3} \\\\ \\frac{2}{3} \\\\ \\frac{2}{3} \\end{bmatrix} = \\begin{bmatrix} -\\frac{1}{\\sqrt{3}} \\\\ \\frac{1}{\\sqrt{3}} \\\\ \\frac{1}{\\sqrt{3}} \\end{bmatrix} \\).<\/p>\n<p>Matrices finales<\/p>\n<p>\\[<br \/>\nQ = \\begin{bmatrix}<br \/>\n\\frac{1}{\\sqrt{2}} &#038; \\frac{1}{\\sqrt{6}} &#038; -\\frac{1}{\\sqrt{3}} \\\\<br \/>\n\\frac{1}{\\sqrt{2}} &#038; -\\frac{1}{\\sqrt{6}} &#038; \\frac{1}{\\sqrt{3}} \\\\<br \/>\n0 &#038; \\sqrt{\\frac{2}{3}} &#038; \\frac{1}{\\sqrt{3}}<br \/>\n\\end{bmatrix}, \\quad<br \/>\nR = \\begin{bmatrix}<br \/>\n\\sqrt{2} &#038; \\frac{1}{\\sqrt{2}} &#038; \\frac{1}{\\sqrt{2}} \\\\<br \/>\n0 &#038; \\sqrt{\\frac{3}{2}} &#038; \\frac{1}{\\sqrt{6}} \\\\<br \/>\n0 &#038; 0 &#038; \\frac{2}{\\sqrt{3}}<br \/>\n\\end{bmatrix}.<br \/>\n\\]\n<\/p><\/div>\n<hr \/>\n<blockquote>\n<p><strong>Ejemplo:<\/strong> Determina la factorizaci\u00f3n QR de la matriz \\(\\begin{bmatrix}<br \/>\n1 &#038; 2 \\\\<br \/>\n1 &#038; 0 \\\\<br \/>\n0 &#038; 1<br \/>\n\\end{bmatrix}\\).<\/p>\n<\/blockquote>\n<p><script>\nfunction showHtmlDiv9ax() {\n  var htmlShow9ax = document.getElementById(\"html-show9ax\");\n  if (htmlShow9ax.style.display === \"none\") {\n    htmlShow9ax.style.display = \"block\";\n  } else {\n    htmlShow9ax.style.display = \"none\";\n  }\n}\n<\/script><\/p>\n<p><button onclick=\"showHtmlDiv9ax()\">Soluci\u00f3n:<\/button><\/p>\n<div id=\"html-show9ax\" style=\"display: none;\">\nPaso 1: Primera columna<\/p>\n<p>&#8211; \\( \\mathbf{a}_1 = \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} \\).<br \/>\n&#8211; \\( \\mathbf{v}_1 = \\mathbf{a}_1 \\).<br \/>\n&#8211; \\( r_{11} = \\| \\mathbf{v}_1 \\| = \\sqrt{1^2 + 1^2 + 0^2} = \\sqrt{2} \\).<br \/>\n&#8211; \\( \\mathbf{q}_1 = \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} \\).<\/p>\n<p>Paso 2: Segunda columna<\/p>\n<p>&#8211; \\( \\mathbf{a}_2 = \\begin{bmatrix} 2 \\\\ 0 \\\\ 1 \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{12} = \\mathbf{q}_1^t \\mathbf{a}_2 = \\frac{1}{\\sqrt{2}} (1\\cdot2 + 1\\cdot0 + 0\\cdot1) = \\frac{2}{\\sqrt{2}} = \\sqrt{2} \\).<br \/>\n&#8211; \\( \\mathbf{v}_2 = \\mathbf{a}_2 &#8211; r_{12} \\mathbf{q}_1 = \\begin{bmatrix} 2 \\\\ 0 \\\\ 1 \\end{bmatrix} &#8211; \\sqrt{2} \\cdot \\frac{1}{\\sqrt{2}} \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 2 \\\\ 0 \\\\ 1 \\end{bmatrix} &#8211; \\begin{bmatrix} 1 \\\\ 1 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 1 \\\\ -1 \\\\ 1 \\end{bmatrix} \\).<br \/>\n&#8211; \\( r_{22} = \\| \\mathbf{v}_2 \\| = \\sqrt{1^2 + (-1)^2 + 1^2} = \\sqrt{3} \\).<br \/>\n&#8211; \\( \\mathbf{q}_2 = \\frac{1}{\\sqrt{3}} \\begin{bmatrix} 1 \\\\ -1 \\\\ 1 \\end{bmatrix} \\).<\/p>\n<p>Matrices finales<\/p>\n<p>\\[<br \/>\nQ = \\begin{bmatrix}<br \/>\n\\frac{1}{\\sqrt{2}} &#038; \\frac{1}{\\sqrt{3}} \\\\<br \/>\n\\frac{1}{\\sqrt{2}} &#038; -\\frac{1}{\\sqrt{3}} \\\\<br \/>\n0 &#038; \\frac{1}{\\sqrt{3}}<br \/>\n\\end{bmatrix}, \\quad<br \/>\nR = \\begin{bmatrix}<br \/>\n\\sqrt{2} &#038; \\sqrt{2} \\\\<br \/>\n0 &#038; \\sqrt{3}<br \/>\n\\end{bmatrix}.<br \/>\n\\]\n<\/p><\/div>\n<hr \/>\n<h3>Unicidad de la Factorizaci\u00f3n QR<\/h3>\n<p>La unicidad de la factorizaci\u00f3n QR depende de dos condiciones cruciales: el <em>rango<\/em> de la matriz \\(A\\) y la <em>restricci\u00f3n de los signos<\/em> en la matriz \\(R\\).<\/p>\n<blockquote><p>\nLa factorizaci\u00f3n QR es \u00fanica si y solo si se cumplen dos condiciones:<\/p>\n<ol>\n<li>La matriz \\(A\\) tiene columnas linealmente independientes (es decir, \\(\\text{rango}(A) = n\\) si \\(A\\) es \\(m \\times n\\) con \\(m \\ge n\\)).<\/li>\n<li>Todos los elementos de la diagonal de la matriz triangular superior \\(R\\), \\(r_{ii}\\), son positivos: \\( r_{ii} > 0 \\)<\/li>\n<\/ol>\n<\/blockquote>\n<p>Si estas dos condiciones se satisfacen, la factorizaci\u00f3n $A = QR$ es \u00fanica. Esta es la forma en que el Algoritmo QR y las implementaciones de bibliotecas num\u00e9ricas suelen requerirla.<\/p>\n<h3>Aplicaciones Clave en Ingenier\u00eda Inform\u00e1tica<\/h3>\n<p>La factorizaci\u00f3n QR es fundamental para:<\/p>\n<ul>\n<li><strong>M\u00ednimos Cuadrados<\/strong>: Permite resolver sistemas de ecuaciones sobredeterminados de la forma \\(A\\mathbf{x} = \\mathbf{b}\\) de una manera computacionalmente eficiente y estable. La soluci\u00f3n \\(\\mathbf{x}\\) se obtiene resolviendo el sistema m\u00e1s simple \\(R\\mathbf{x} = Q^t\\mathbf{b}\\).<\/li>\n<li><strong>C\u00e1lculo de Autovalores<\/strong>: El <strong>Algoritmo QR<\/strong> itera esta descomposici\u00f3n para converger a los autovalores de una matriz. Es el m\u00e9todo m\u00e1s utilizado en la pr\u00e1ctica para este fin.<\/li>\n<li><strong>Bases Orthonormales<\/strong>: Proporciona un m\u00e9todo directo para construir bases ortonormales para subespacios vectoriales (mediante las columnas de \\(Q\\)), lo cual es importante en gr\u00e1ficos por computadora y procesamiento de se\u00f1ales.<\/li>\n<\/ul>\n<h3>M\u00e9todo QR para m\u00ednimos cuadrados<\/h3>\n<p>Para resolver un problema de m\u00ednimos cuadrados mediante factorizaci\u00f3n QR con la matriz 3\u00d72 anterior, consideramos el sistema sobredeterminado \\( A \\mathbf{x} = \\mathbf{b} \\), donde la soluci\u00f3n \\( \\mathbf{x} \\) minimiza \\( \\| A\\mathbf{x} &#8211; \\mathbf{b} \\|_2 \\). <\/p>\n<p>Datos del problema<\/p>\n<p>\\[<br \/>\nA = \\begin{bmatrix}<br \/>\n1 &#038; 2 \\\\<br \/>\n1 &#038; 0 \\\\<br \/>\n0 &#038; 1<br \/>\n\\end{bmatrix}, \\quad<br \/>\n\\mathbf{b} = \\begin{bmatrix} 3 \\\\ 1 \\\\ 2 \\end{bmatrix}.<br \/>\n\\]<\/p>\n<p>Usamos la factorizaci\u00f3n QR ya calculada (\u00abdelgada\u00bb):<\/p>\n<p>\\[<br \/>\nQ = \\begin{bmatrix}<br \/>\n\\frac{1}{\\sqrt{2}} &#038; \\frac{1}{\\sqrt{3}} \\\\<br \/>\n\\frac{1}{\\sqrt{2}} &#038; -\\frac{1}{\\sqrt{3}} \\\\<br \/>\n0 &#038; \\frac{1}{\\sqrt{3}}<br \/>\n\\end{bmatrix}, \\quad<br \/>\nR = \\begin{bmatrix}<br \/>\n\\sqrt{2} &#038; \\sqrt{2} \\\\<br \/>\n0 &#038; \\sqrt{3}<br \/>\n\\end{bmatrix}.<br \/>\n\\]<\/p>\n<p>M\u00e9todo QR para m\u00ednimos cuadrados<\/p>\n<p>El problema \\( \\min \\| A\\mathbf{x} &#8211; \\mathbf{b} \\|_2 \\) se resuelve as\u00ed: <\/p>\n<p>1. Sistema transformado: Como \\( A = QR \\), entonces \\( \\| A\\mathbf{x} &#8211; \\mathbf{b} \\|_2 = \\| QR\\mathbf{x} &#8211; \\mathbf{b} \\|_2 = \\| R\\mathbf{x} &#8211; Q^t \\mathbf{b} \\|_2 \\) (por ortogonalidad de Q).<\/p>\n<p>2. Proyecci\u00f3n: Definimos \\( \\mathbf{c} = Q^t \\mathbf{b} \\), entonces resolvemos el sistema triangular \\( R\\mathbf{x} = \\mathbf{c} \\) (sustituci\u00f3n hacia atr\u00e1s).<\/p>\n<p>Paso 1: Calcular \\( \\mathbf{c} = Q^t \\mathbf{b} \\)<\/p>\n<p>\\[<br \/>\n\\mathbf{c} = Q^t \\mathbf{b} = \\begin{bmatrix}<br \/>\n\\frac{1}{\\sqrt{2}} &#038; \\frac{1}{\\sqrt{2}} &#038; 0 \\\\<br \/>\n\\frac{1}{\\sqrt{3}} &#038; -\\frac{1}{\\sqrt{3}} &#038; \\frac{1}{\\sqrt{3}}<br \/>\n\\end{bmatrix}<br \/>\n\\begin{bmatrix} 3 \\\\ 1 \\\\ 2 \\end{bmatrix}<br \/>\n= \\begin{bmatrix}<br \/>\n\\frac{1}{\\sqrt{2}}(3+1+0) \\\\<br \/>\n\\frac{1}{\\sqrt{3}}(3-1+2)<br \/>\n\\end{bmatrix}<br \/>\n= \\begin{bmatrix}<br \/>\n\\frac{4}{\\sqrt{2}}\\\\<br \/>\n\\frac{4}{\\sqrt{3}}<br \/>\n\\end{bmatrix}.<br \/>\n\\]<\/p>\n<p>Paso 2: Resolver \\( R\\mathbf{x} = \\mathbf{c} \\)<\/p>\n<p>Sistema triangular superior:<br \/>\n\\[<br \/>\n\\begin{bmatrix}<br \/>\n\\sqrt{2} &#038; \\sqrt{2} \\\\<br \/>\n0 &#038; \\sqrt{3}<br \/>\n\\end{bmatrix}<br \/>\n\\begin{bmatrix} x_1 \\\\ x_2 \\end{bmatrix}<br \/>\n= \\begin{bmatrix} \\frac{4}{\\sqrt{2}} \\\\ \\frac{4}{\\sqrt{3}} \\end{bmatrix}.<br \/>\n\\]<\/p>\n<p>Sustituci\u00f3n hacia atr\u00e1s:<br \/>\n&#8211; De la segunda ecuaci\u00f3n: \\( \\sqrt{3} x_2 = \\frac{4}{\\sqrt{3}} \\Rightarrow x_2 = \\frac{4}{3} \\).<br \/>\n&#8211; Primera ecuaci\u00f3n: \\( \\sqrt{2} x_1 + \\sqrt{2} \\cdot \\frac{4}{3} = \\frac{4}{\\sqrt{2}} \\Rightarrow \\sqrt{2} x_1 = \\frac{4}{\\sqrt{2}} &#8211; \\frac{4\\sqrt{2}}{3} = \\sqrt{2} \\left(2 &#8211; \\frac{4}{3}\\right) = \\sqrt{2} \\cdot \\frac{2}{3} \\Rightarrow x_1 = \\frac{2}{3} \\).<\/p>\n<p>Soluci\u00f3n: \\( \\mathbf{x} = \\begin{bmatrix} \\frac{2}{3} \\\\ \\frac{4}{3} \\end{bmatrix} \\).<\/p>\n<p>Verificaci\u00f3n<\/p>\n<p>&#8211; \\( A\\mathbf{x} = \\begin{bmatrix} 1 &#038; 2 \\\\ 1 &#038; 0 \\\\ 0 &#038; 1 \\end{bmatrix} \\begin{bmatrix} \\frac{2}{3} \\\\ \\frac{4}{3} \\end{bmatrix} = \\begin{bmatrix} \\frac{10}{3} \\\\ \\frac{2}{3} \\\\ \\frac{4}{3} \\end{bmatrix} \\).<br \/>\n&#8211; Residuo: \\( \\| A\\mathbf{x} &#8211; \\mathbf{b} \\|_2 = \\sqrt{ \\left(\\frac{10}{3}-3\\right)^2 + \\left(\\frac{2}{3}-1\\right)^2 + \\left(\\frac{4}{3}-2\\right)^2 } = \\sqrt{ \\frac{1}{9} + \\frac{1}{9} + \\frac{1}{9} } = \\frac{1}{\\sqrt{3}} \\), que coincide con el componente de \\( \\mathbf{b} \\) ortogonal al rango de A (tercera fila de Q). <\/p>\n<p>Este m\u00e9todo es num\u00e9ricamente estable porque solo requiere resolver un sistema triangular.<\/p>\n<table id=\"yzpi\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" bgcolor=\"#999999\">\n<tbody>\n<tr>\n<td width=\"100%\">\n<p><strong>Ejercicio:<\/strong> \u00bfDe cuantos grados es el giro que proporciona la matriz \\(\\begin{bmatrix}0&#038;-1\\\\ 1&#038;0\\end{bmatrix}\\)? <\/p>\n<div id=\"menu-a\">\n<ul>\n<li>45\u00ba<\/li>\n<li>90\u00ba<\/li>\n<li>120\u00ba<\/li>\n<\/ul>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><script>\nfunction showHtmlDiv() {\n  var htmlShow = document.getElementById(\"html-show\");\n  if (htmlShow.style.display === \"none\") {\n    htmlShow.style.display = \"block\";\n  } else {\n    htmlShow.style.display = \"none\";\n  }\n}\n<\/script><\/p>\n<p><button onclick=\"showHtmlDiv()\">Soluci\u00f3n:<\/button><\/p>\n<div id=\"html-show\" style=\"display: none;\">\n<p><strong>B.)<\/strong><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>La Factorizaci\u00f3n QR (o Descomposici\u00f3n QR) es un proceso por el cual una matriz \\(A\\) se expresa como el producto de dos matrices especiales: una matriz ortogonal \\(Q\\) y una matriz triangular&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-622","post","type-post","status-publish","format-standard","hentry","category-algebra"],"_links":{"self":[{"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/posts\/622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=622"}],"version-history":[{"count":27,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions"}],"predecessor-version":[{"id":676,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=\/wp\/v2\/posts\/622\/revisions\/676"}],"wp:attachment":[{"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clases.jesussoto.es\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}