Skip to content

Instantly share code, notes, and snippets.

@dandrake
Last active August 29, 2015 14:21
Show Gist options
  • Save dandrake/1b76239f680476c21d6c to your computer and use it in GitHub Desktop.
Save dandrake/1b76239f680476c21d6c to your computer and use it in GitHub Desktop.
Cheryl, eigenvalues, eigenvectors
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": false
},
"source": [
"# Cheryl, eigenvalues, eigenvectors\n",
"\n",
"I wrote an amazing exam problem and I want to share it with everyone.\n",
"\n",
"## Context\n",
"\n",
"This semester (spring 2015) on each exam I've had a question that involved a conversation between [Jake and Izzy](https://en.wikipedia.org/wiki/Jake_and_the_Never_Land_Pirates). My young son watches the show and I often use character names from his shows on my exams.\n",
"\n",
"Recently the [Cheryl's birthday problem](https://en.wikipedia.org/wiki/Cheryl%27s_Birthday) went viral and I wanted to someone include something like it on the final exam for my linear algebra course.\n",
"\n",
"You should read the Cheryl's birthday problem if you don't already know it. My problem does contain the answer to that problem, so stop reading if you don't want the Cheryl problem spoiled.\n",
"\n",
"## The problem\n",
"\n",
"Jake and Izzy have just become friends with Cheryl and\n",
"they want to know when her birthday is. Cheryl gives them a list of 10\n",
"possible dates and says, \"I'll give each of you a clue, and then\n",
"we'll s--\"\n",
"\n",
"\"Nevermind, I know it,\" says Jake.\n",
"\n",
"\"But...how? I haven't even told you what month my birthday is!\" says Cheryl.\n",
"\n",
"\"I texted Albert and Bernard, and they told me,\" says Jake.\n",
"\n",
"Cheryl is upset. \"No! That's not what you're suppo--\"\n",
"\n",
"\"Besides, we'd rather talk about linear algebra,\" says Izzy. \"Here\n",
"are three matrices:\n",
"$$\n",
"A = \\begin{pmatrix} 5 & 16 \\\\ -3 & -9 \\end{pmatrix},\\quad\n",
"B = \\begin{pmatrix} -1 & -4 \\\\ 0 & 1 \\end{pmatrix},\\quad\n",
"C = \\begin{pmatrix} 7 & 16 \\\\ -3 & -7 \\end{pmatrix}.\n",
"$$\n",
"One of them is my favorite $2 \\times 2$ matrix.\"\n",
"\n",
"Izzy tells Jake an eigenvalue of her favorite matrix and tells Cheryl an eigenvector of her favorite matrix. Jake and Cheryl wander off spouting cryptic remarks about what they do and do not know.\n",
"\n",
"1. What eigenvalue could Izzy have told Jake so that he could determine her favorite matrix with only that information? What matrix is her favorite in that case? Explain your reasoning.\n",
"2. What eigenvector could Izzy have told Cheryl so that she could determine Izzy's favorite matrix with only that information? What matrix is her favorite in that case? Explain your reasoning.\n",
"\n",
"## Why is this problem so cool?\n",
"\n",
"Actually it's the matrices and their associated eigenstuff that is so cool. It took me a truly ridiculous amount of time, but I found matrices with an amazing collection of properties.\n",
"\n",
"* One eigenvalue appears in one matrix, another eigenvalue appears in two matrices, and one eigenvalue appears in all three matrices. (The matrix with the \"appears in one matrix\" eigenvalue is, obviously, the answer to question 1.)\n",
"* The same is true for (appropriately scaled versions of) the eigenvectors.\n",
"* The eigenvalues and eigenvectors are all integer-valued and don't require any complicated arithmetic.\n",
"* The first row of $C$ has Cheryl's birthday.\n",
"* The first row of $A$ has the day after my course's final exam (May 15).\n",
"* My own birthday can be found by taking sums and products of other rows (and ignoring signs).\n",
"* My course is Math 340, and $-3$, $-4$ and $0$ are entries in the matrices.\n",
"* The antidiagonals of $A$ and $C$ are the same.\n",
"* The diagonals of $B$ and $C$ are multiples of one another.\n",
"\n",
"## The solution\n",
"\n",
"$A$ has $-3$ as an eigenvalue.\n",
"$B$ and $C$ both have $+1$ as an eigenvalues. All three have $-1$ as an eigenvalue. So eigenvalue $-3$ uniquely identifies matrix $A$.\n",
"\n",
"Eigenvectors: $B$ has $(1,0)$. $A$ and $C$ both have $(8,-3)$. All three have $(2,-1)$. So $(1,0)$ uniquely identifies matrix $B$.\n",
"\n",
"Maybe you don't believe me, so let's calculate.\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%load_ext sage"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"A = matrix([[5,16],\n",
" [-3,-9]])\n",
"B = matrix([[-1,-4],\n",
" [0,1]])\n",
"C = matrix([[7,16],\n",
" [-3,-7]])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The left matrix has the eigenvalues down the diagonal; the right matrix has the corresponding eigenvectors as columns. Sage normalizes the eigenvectors so that the first nonzero entry is 1."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(\n",
"[-1 0] [ 1 1]\n",
"[ 0 -3], [-3/8 -1/2]\n",
")"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"A.eigenmatrix_right()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(\n",
"[ 1 0] [ 1 1]\n",
"[ 0 -1], [-1/2 0]\n",
")"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"B.eigenmatrix_right()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(\n",
"[ 1 0] [ 1 1]\n",
"[ 0 -1], [-3/8 -1/2]\n",
")"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C.eigenmatrix_right()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.8"
},
"name": "Cheryls eigenvectors and eigenvalues.ipynb"
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment