commit 95da677639058458bfaf1b6edc1efebfa81f313e from: Ale date: Mon Feb 2 19:04:09 2026 UTC Agrega Solucion_EV01 notebook commit - b8b4747c8edad1a408e5ea7b15108399878ee3db commit + 95da677639058458bfaf1b6edc1efebfa81f313e blob - /dev/null blob + 1b2c831787f382a94a9fa46c24e6fb401b7e458d (mode 644) --- /dev/null +++ NoteBooks/Solucion_EV01.ipynb @@ -0,0 +1,356 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "aa8b1746", + "metadata": {}, + "source": [ + "# Resolución de Evaluación EV01 - Álgebra Lineal\n", + "\n", + "Este notebook contiene la resolución detallada de los problemas presentados en el archivo EV01.pdf. Cada problema incluye una explicación teórica, el desarrollo paso a paso y, en algunos casos, una verificación mediante código Python." + ] + }, + { + "cell_type": "markdown", + "id": "9db1247d", + "metadata": {}, + "source": [ + "## Problema 1: Sistema de Ecuaciones con Parámetro\n", + "\n", + "Considere el sistema:\n", + "$$\\begin{cases} x + y + z = 2 \\\\ x + 2y + kz = 3 \\\\ 2x + 3y + 3z = k + 3 \\end{cases}$$\n", + "\n", + "### Resolución\n", + "\n", + "Escribimos la matriz aumentada y aplicamos eliminación de Gauss:\n", + "$$\\begin{pmatrix} 1 & 1 & 1 & | & 2 \\\\ 1 & 2 & k & | & 3 \\\\ 2 & 3 & 3 & | & k+3 \\end{pmatrix}$$\n", + "\n", + "1. $R_2 \\to R_2 - R_1$ y $R_3 \\to R_3 - 2R_1$:\n", + "$$\\begin{pmatrix} 1 & 1 & 1 & | & 2 \\\\ 0 & 1 & k-1 & | & 1 \\\\ 0 & 1 & 1 & | & k-1 \\end{pmatrix}$$\n", + "\n", + "2. $R_3 \\to R_3 - R_2$:\n", + "$$\\begin{pmatrix} 1 & 1 & 1 & | & 2 \\\\ 0 & 1 & k-1 & | & 1 \\\\ 0 & 0 & 2-k & | & k-2 \\end{pmatrix}$$\n", + "\n", + "**Análisis:**\n", + "- **(a) Solución única:** Ocurre si el rango de la matriz es 3, es decir, $2-k \\neq 0 \\implies k \\neq 2$.\n", + "- **(b) Infinitas soluciones:** Si $k=2$, la última fila es $(0, 0, 0 | 0)$. El sistema es consistente con una variable libre.\n", + "- **(c) Ninguna solución:** No hay valores de $k$ que produzcan una contradicción del tipo $(0, 0, 0 | c)$ con $c \\neq 0$, ya que si $2-k=0$, entonces $k-2=0$.\n", + "\n", + "**Caso (b) k=2:**\n", + "El sistema queda:\n", + "$y + z = 1 \\implies y = 1 - z$\n", + "$x + y + z = 2 \\implies x + (1-z) + z = 2 \\implies x = 1$\n", + "Solución: $(1, 1-z, z) = (1, 1, 0) + z(0, -1, 1)$.\n", + "El conjunto solución es el **span{(0, -1, 1)}** desplazado por el punto $(1, 1, 0)$." + ] + }, + { + "cell_type": "code", + "id": "a41cdc7a", + "metadata": { + "ExecuteTime": { + "end_time": "2026-02-02T17:27:37.439236230Z", + "start_time": "2026-02-02T17:27:37.390643257Z" + } + }, + "source": [ + "import sympy as sp\n", + "k = sp.symbols('k')\n", + "A = sp.Matrix([[1, 1, 1, 2], [1, 2, k, 3], [2, 3, 3, k+3]])\n", + "# Verificamos para k=2\n", + "A_k2 = A.subs(k, 2)\n", + "print(\"Matriz para k=2:\")\n", + "sp.pprint(A_k2)\n", + "print(\"\\nSolución para k=2:\")\n", + "sp.pprint(sp.solve_linear_system(A_k2, *sp.symbols('x y z')))\n", + "\n", + "# Verificamos determinante de la matriz de coeficientes\n", + "M = A[:, :3]\n", + "print(f\"\\nDeterminante de M: {M.det()}\")" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Matriz para k=2:\n", + "⎡1 1 1 2⎤\n", + "⎢ ⎥\n", + "⎢1 2 2 3⎥\n", + "⎢ ⎥\n", + "⎣2 3 3 5⎦\n", + "\n", + "Solución para k=2:\n", + "{x: 1, y: 1 - z}\n", + "\n", + "Determinante de M: 2 - k\n" + ] + } + ], + "execution_count": 4 + }, + { + "cell_type": "markdown", + "id": "e9d333a9", + "metadata": {}, + "source": [ + "## Problema 2: Condiciones de Pertenencia al Span\n", + "\n", + "Sean $v_1 = (1, 0, -1, 2)$ y $v_2 = (2, 3, 1, 1)$. Buscamos condiciones para $b = (b_1, b_2, b_3, b_4)$ tal que $b \\in \\text{span}\\{v_1, v_2\\}$.\n", + "\n", + "### Resolución\n", + "\n", + "El vector $b$ está en el span si existen escalares $c_1, c_2$ tales que $c_1 v_1 + c_2 v_2 = b$. Esto equivale a que el sistema sea consistente:\n", + "$$\\begin{pmatrix} 1 & 2 & | & b_1 \\\\ 0 & 3 & | & b_2 \\\\ -1 & 1 & | & b_3 \\\\ 2 & 1 & | & b_4 \\end{pmatrix}$$\n", + "\n", + "Reducimos la matriz:\n", + "1. $R_3 \\to R_3 + R_1$:\n", + "$$\\begin{pmatrix} 1 & 2 & | & b_1 \\\\ 0 & 3 & | & b_2 \\\\ 0 & 3 & | & b_3 + b_1 \\\\ 2 & 1 & | & b_4 \\end{pmatrix}$$\n", + "\n", + "2. $R_4 \\to R_4 - 2R_1$:\n", + "$$\\begin{pmatrix} 1 & 2 & | & b_1 \\\\ 0 & 3 & | & b_2 \\\\ 0 & 3 & | & b_3 + b_1 \\\\ 0 & -3 & | & b_4 - 2b_1 \\end{pmatrix}$$\n", + "\n", + "3. $R_3 \\to R_3 - R_2$ y $R_4 \\to R_4 + R_2$:\n", + "$$\\begin{pmatrix} 1 & 2 & | & b_1 \\\\ 0 & 3 & | & b_2 \\\\ 0 & 0 & | & b_3 + b_1 - b_2 \\\\ 0 & 0 & | & b_4 - 2b_1 + b_2 \\end{pmatrix}$$\n", + "\n", + "Para consistencia, las últimas dos entradas deben ser cero:\n", + "1. $b_1 - b_2 + b_3 = 0$\n", + "2. $-2b_1 + b_2 + b_4 = 0$" + ] + }, + { + "cell_type": "markdown", + "id": "47449e8a", + "metadata": {}, + "source": [ + "## Problema 3: Potencias de una Matriz\n", + "\n", + "Sea $A = \\begin{pmatrix} 1 & 1 & 0 \\\\ 0 & 1 & 1 \\\\ 0 & 0 & 1 \\end{pmatrix}$.\n", + "\n", + "### Resolución\n", + "\n", + "Podemos escribir $A = I + N$, donde $N = \\begin{pmatrix} 0 & 1 & 0 \\\\ 0 & 0 & 1 \\\\ 0 & 0 & 0 \\end{pmatrix}$.\n", + "Notamos que:\n", + "$N^2 = \\begin{pmatrix} 0 & 0 & 1 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{pmatrix}$, $N^3 = 0$.\n", + "\n", + "Usando el binomio de Newton (ya que $I$ y $N$ conmutan):\n", + "$A^n = (I + N)^n = \\sum_{k=0}^{n} \\binom{n}{k} I^{n-k} N^k = \\binom{n}{0}I + \\binom{n}{1}N + \\binom{n}{2}N^2$\n", + "$A^n = I + nN + \\frac{n(n-1)}{2}N^2$\n", + "\n", + "$$A^n = \\begin{pmatrix} 1 & n & \\frac{n(n-1)}{2} \\\\ 0 & 1 & n \\\\ 0 & 0 & 1 \\end{pmatrix}$$" + ] + }, + { + "cell_type": "code", + "id": "c00bdb48", + "metadata": { + "ExecuteTime": { + "end_time": "2026-02-02T17:27:37.546444097Z", + "start_time": "2026-02-02T17:27:37.468342936Z" + } + }, + "source": [ + "A = sp.Matrix([[1, 1, 0], [0, 1, 1], [0, 0, 1]])\n", + "print(\"A^2:\")\n", + "sp.pprint(A**2)\n", + "print(\"\\nA^3:\")\n", + "sp.pprint(A**3)\n", + "print(\"\\nA^4:\")\n", + "sp.pprint(A**4)" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A^2:\n", + "⎡1 2 1⎤\n", + "⎢ ⎥\n", + "⎢0 1 2⎥\n", + "⎢ ⎥\n", + "⎣0 0 1⎦\n", + "\n", + "A^3:\n", + "⎡1 3 3⎤\n", + "⎢ ⎥\n", + "⎢0 1 3⎥\n", + "⎢ ⎥\n", + "⎣0 0 1⎦\n", + "\n", + "A^4:\n", + "⎡1 4 6⎤\n", + "⎢ ⎥\n", + "⎢0 1 4⎥\n", + "⎢ ⎥\n", + "⎣0 0 1⎦\n" + ] + } + ], + "execution_count": 5 + }, + { + "cell_type": "markdown", + "id": "a4e8703c", + "metadata": {}, + "source": [ + "## Problema 4: Matrices de Pauli y Conmutadores\n", + "\n", + "Demostrar $[\\sigma_x, \\sigma_y] = 2i\\sigma_z$.\n", + "\n", + "### Resolución\n", + "\n", + "$\\sigma_x = \\begin{pmatrix} 0 & 1 \\\\ 1 & 0 \\end{pmatrix}, \\sigma_y = \\begin{pmatrix} 0 & -i \\\\ i & 0 \\end{pmatrix}, \\sigma_z = \\begin{pmatrix} 1 & 0 \\\\ 0 & -1 \\end{pmatrix}$.\n", + "\n", + "$\\sigma_x \\sigma_y = \\begin{pmatrix} 0 & 1 \\\\ 1 & 0 \\end{pmatrix} \\begin{pmatrix} 0 & -i \\\\ i & 0 \\end{pmatrix} = \\begin{pmatrix} i & 0 \\\\ 0 & -i \\end{pmatrix} = i\\sigma_z$\n", + "\n", + "$\\sigma_y \\sigma_x = \\begin{pmatrix} 0 & -i \\\\ i & 0 \\end{pmatrix} \\begin{pmatrix} 0 & 1 \\\\ 1 & 0 \\end{pmatrix} = \\begin{pmatrix} -i & 0 \\\\ 0 & i \\end{pmatrix} = -i\\sigma_z$\n", + "\n", + "$[\\sigma_x, \\sigma_y] = \\sigma_x \\sigma_y - \\sigma_y \\sigma_x = i\\sigma_z - (-i\\sigma_z) = 2i\\sigma_z$.\n", + "\n", + "**Implicación física:** En mecánica cuántica, si dos observables no conmutan ($[A, B] \\neq 0$), no pueden ser medidos simultáneamente con precisión infinita (Principio de Incertidumbre)." + ] + }, + { + "cell_type": "markdown", + "id": "c8ad4688", + "metadata": {}, + "source": [ + "## Problema 5: Matriz Nilpotente\n", + "\n", + "Sea $A = \\begin{pmatrix} 0 & a & b \\\\ 0 & 0 & c \\\\ 0 & 0 & 0 \\end{pmatrix}$.\n", + "\n", + "### Resolución\n", + "\n", + "Calculamos las potencias:\n", + "$A^2 = \\begin{pmatrix} 0 & 0 & ac \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{pmatrix}$\n", + "$A^3 = \\begin{pmatrix} 0 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{pmatrix} = 0$\n", + "\n", + "Si $a, c \\neq 0$, entonces $ac \\neq 0$, por lo que $A^2 \\neq 0$. El índice de nilpotencia es **3**." + ] + }, + { + "cell_type": "markdown", + "id": "7510dcbe", + "metadata": {}, + "source": [ + "## Problema 6: Matriz de Adyacencia\n", + "\n", + "$M = \\begin{pmatrix} 0 & 1 & 1 \\\\ 1 & 0 & 0 \\\\ 1 & 0 & 0 \\end{pmatrix}$.\n", + "\n", + "### Resolución\n", + "\n", + "$M^2 = \\begin{pmatrix} 0 & 1 & 1 \\\\ 1 & 0 & 0 \\\\ 1 & 0 & 0 \\end{pmatrix} \\begin{pmatrix} 0 & 1 & 1 \\\\ 1 & 0 & 0 \\\\ 1 & 0 & 0 \\end{pmatrix} = \\begin{pmatrix} 2 & 0 & 0 \\\\ 0 & 1 & 1 \\\\ 0 & 1 & 1 \\end{pmatrix}$.\n", + "\n", + "**Interpretación:** La entrada $(M^2)_{ij}$ representa el número de caminos de longitud 2 entre el nodo $i$ y el nodo $j$. Por ejemplo, $(M^2)_{11} = 2$ indica que hay dos caminos de ida y vuelta desde el nodo 1 (1-2-1 y 1-3-1)." + ] + }, + { + "cell_type": "markdown", + "id": "fef32579", + "metadata": {}, + "source": [ + "## Problema 7: Interpolación Polinómica\n", + "\n", + "$p(x) = ax^2 + bx + c$ pasa por $(-1, 9), (1, 3), (2, 6)$.\n", + "\n", + "### Resolución\n", + "\n", + "Sustituimos los puntos:\n", + "1. $a(-1)^2 + b(-1) + c = 9 \\implies a - b + c = 9$\n", + "2. $a(1)^2 + b(1) + c = 3 \\implies a + b + c = 3$\n", + "3. $a(2)^2 + b(2) + c = 6 \\implies 4a + 2b + c = 6$\n", + "\n", + "Sistema matricial:\n", + "$$\\begin{pmatrix} 1 & -1 & 1 \\\\ 1 & 1 & 1 \\\\ 4 & 2 & 1 \\end{pmatrix} \\begin{pmatrix} a \\\\ b \\\\ c \\end{pmatrix} = \\begin{pmatrix} 9 \\\\ 3 \\\\ 6 \\end{pmatrix}$$\n", + "\n", + "Resolviendo:\n", + "$R_2 - R_1 \\implies 2b = -6 \\implies b = -3$\n", + "$R_1 \\implies a + 3 + c = 9 \\implies a + c = 6$\n", + "$R_3 \\implies 4a + 2(-3) + c = 6 \\implies 4a + c = 12$\n", + "$(4a + c) - (a + c) = 12 - 6 \\implies 3a = 6 \\implies a = 2$\n", + "$c = 6 - 2 = 4$\n", + "\n", + "El polinomio es **$p(x) = 2x^2 - 3x + 4$**." + ] + }, + { + "cell_type": "code", + "id": "892e5c9e", + "metadata": { + "ExecuteTime": { + "end_time": "2026-02-02T17:27:37.604801408Z", + "start_time": "2026-02-02T17:27:37.560845494Z" + } + }, + "source": [ + "A_poly = sp.Matrix([[1, -1, 1], [1, 1, 1], [4, 2, 1]])\n", + "b_poly = sp.Matrix([9, 3, 6])\n", + "sol_poly = A_poly.solve(b_poly)\n", + "print(\"Solución (a, b, c):\")\n", + "sp.pprint(sol_poly)" + ], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solución (a, b, c):\n", + "⎡2 ⎤\n", + "⎢ ⎥\n", + "⎢-3⎥\n", + "⎢ ⎥\n", + "⎣4 ⎦\n" + ] + } + ], + "execution_count": 6 + }, + { + "cell_type": "markdown", + "id": "e0c4414b", + "metadata": {}, + "source": [ + "## Problema 8: Matriz por Bloques\n", + "\n", + "Demostrar que si $M = \\begin{pmatrix} A & 0 \\\\ 0 & B \\end{pmatrix}$, entonces $M^k = \\begin{pmatrix} A^k & 0 \\\\ 0 & B^k \\end{pmatrix}$.\n", + "\n", + "### Resolución\n", + "\n", + "Por inducción:\n", + "- Base $k=1$: Es trivial.\n", + "- Hipótesis: $M^k = \\begin{pmatrix} A^k & 0 \\\\ 0 & B^k \\end{pmatrix}$.\n", + "- Paso $k+1$:\n", + "$M^{k+1} = M^k M = \\begin{pmatrix} A^k & 0 \\\\ 0 & B^k \\end{pmatrix} \\begin{pmatrix} A & 0 \\\\ 0 & B \\end{pmatrix} = \\begin{pmatrix} A^k A + 0 & 0 + 0 \\\\ 0 + 0 & 0 + B^k B \\end{pmatrix} = \\begin{pmatrix} A^{k+1} & 0 \\\\ 0 & B^{k+1} \\end{pmatrix}$.\n", + "Queda demostrado." + ] + }, + { + "cell_type": "markdown", + "id": "3995d78c", + "metadata": {}, + "source": [ + "## Problema 9: Propiedad de la Traza\n", + "\n", + "Demostrar $\\text{tr}(AB) = \\text{tr}(BA)$.\n", + "\n", + "### Resolución\n", + "\n", + "Sea $A$ de $n \\times n$ con elementos $a_{ij}$ y $B$ con elementos $b_{ij}$.\n", + "La entrada $(i, i)$ de $AB$ es $(AB)_{ii} = \\sum_{j=1}^n a_{ij} b_{ji}$.\n", + "La traza es:\n", + "$$\\text{tr}(AB) = \\sum_{i=1}^n (AB)_{ii} = \\sum_{i=1}^n \\sum_{j=1}^n a_{ij} b_{ji}$$\n", + "\n", + "Para $BA$, la entrada $(j, j)$ es $(BA)_{jj} = \\sum_{i=1}^n b_{ji} a_{ij}$.\n", + "La traza es:\n", + "$$\\text{tr}(BA) = \\sum_{j=1}^n (BA)_{jj} = \\sum_{j=1}^n \\sum_{i=1}^n b_{ji} a_{ij}$$\n", + "\n", + "Como la suma es finita, podemos intercambiar el orden:\n", + "$$\\sum_{i=1}^n \\sum_{j=1}^n a_{ij} b_{ji} = \\sum_{j=1}^n \\sum_{i=1}^n b_{ji} a_{ij}$$\n", + "Por lo tanto, $\\text{tr}(AB) = \\text{tr}(BA)$." + ] + } + ], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +}