# Questions tagged [linear-algebra]

For challenges involving linear algebra, the mathematics of vector spaces and linear mappings between them.

53 questions
Filter by
Sorted by
Tagged with
1k views

### Contract a tensor

Introduction Tensor contraction is an operation that can be performed on a tensor. It is a generalization of the idea of the trace of a matrix. For example, if we have a rank-2 tensor (a matrix) and ...
• 1,805
1 vote
140 views

### Produce a secure block cipher round function (1 bit round key; 7 bit message)

We need to produce a block cipher round function with a 1 bit round key size and a 7 bit message size with the highest level of cryptographic security according to our measure of security. ...
2k views

• 10.5k
478 views

### NxM List Combination Closest to Target

Given a list of N lists, each containing M positive integers, and a separate list of M positive integers (target values), return a list of N scalars (integers with a value of 0 or more) that ...
• 757
332 views

### Appease the Picky Eater

Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he ...
• 757
762 views

• 76k
693 views

### Linear dependences over the field with two elements

The $d$-dimensional vector space $\mathbb{F}_2^d$ over the field with two elements $\mathbb{F}_2$ is the set of vectors of $d$ bits. Addition of vectors is bitwise xor. A linear dependence is ...
• 2,115
570 views

### Explore a Klarner-Rado sequence [duplicate]

One of the Klarner-Rado sequences is defined as follows: the first term is $1$ for all subsequent terms, the following rule applies: if $x$ is present, so are $2x+1$ and $3x+1$ the sequence ...
• 173
2k views

### Reorder a matrix, twice

You are given a square $n \times n$ matrix $A$, and a list (or vector) $u$ of length $n$ containing the numbers $1$ through $n$ (or $0$ through $n-1$). Your task is to reorder the ...
• 9,496
5k views

### Billiard balls collision

Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly elastic collision. The balls are assumed to be ideal ...
• 15.3k
399 views

### Decompose Commutators

A theorem in this paper1 states that every integral n-by-n matrix M over the integers with trace M = 0 is a commutator, that means there are two integral matrices A,B of the same size as M such that M ...
• 43.8k
5k views

1k views

### Find the dot product of Rationals

I was at a friend's house for dinner and they suggested the idea of a "Prime-factor vector space". In this space the positive integers are expressed as a vector such that the nth element in the ...
• 98.5k
2k views

### Generalized matrix trace

Inspiration. Given (by any means): A two-argument (or single argument consisting of a two-element list) black box function, f: ℤ+ × ℤ+ → ℤ+ (input and output are 1,...
• 30.2k
3k views

### Characteristic polynomial

The characteristic polynomial of a square matrix $A$ is defined as the polynomial $p_A(x) = \det(Ix-A)$ where $I$ is the identity matrix and $\det$ the determinant. Note that this definition ...
• 16.8k
2k views

### Eigenvalues of a Matrix

Given a square matrix, output the matrix's eigenvalues. Each eigenvalue should be repeated a number of times equal to its algebraic multiplicity. The eigenvalues of a matrix ...
709 views

### Solve a matrix equation by Jacobi's method (Revised)

Mathematical Background Let A be an N by N matrix of real numbers, b a vector of N real numbers and x a vector N unknown real numbers. A matrix equation is Ax = b. Jacobi's method is as follows: ...
• 219
4k views

### Determinant of an Integer Matrix

Given a square integer matrix as input, output the determinant of the matrix. Rules You may assume that all elements in the matrix, the determinant of the matrix, and the total number of elements in ...
2k views

### Is the matrix rank-one?

Given a matrix of integers, test if it's rank-one, meaning that every row is a multiple of the same vector. For example, in ...
• 145k
2k views

### Verify Eigenpairs

In this challenge, you will be given a square matrix A, a vector v, and a scalar λ. You will ...
• 42.4k
4k views

### Symbolic matrix multiplication

There are lots of different ways to explain matrix multiplication. I'll stick with a single figure since I believe most people here are familiar with it (and the figure is very descriptive). If you ...
• 46.3k
4k views

### Arnold's Cat Map

Challenge Given a colour raster image* with the same width and height, output the image transformed under Arnold's cat map. (*details see below) Definition Given the size of the image ...
• 43.8k
459 views

### Totally Invertible Submatrices

(inspired by this question over on Math) The Definitions Given an n x n square matrix A, we can call it invertible if there ...
• 43.4k
410 views

### Generate binary matrices which are distinct up to reflections

Here are all the 2x2 binary matrices ...
• 891
752 views

### Dot Product of Diagonals

This challenge is very simple. You are given as input a square matrix, represented in any sane way, and you have to output the dot product of the diagonals of the matrix. The diagonals in specific are ...
• 25.7k
378 views

• 43.8k
1k views

### Recursive 2x2 determinant

The determinant of a 2 by 2 matrix a b c d is given by ad - bc. Given a matrix of digits with dimensions 2n by 2n, n ≥ 1, ...
• 61.9k
2k views

### Find the Cross Product

The cross product of two three-dimensional vectors $\vec a$ and $\vec b$ is the unique vector $\vec c$ such that: ﻿$\vec c$ is orthogonal to both $\vec a$ and $\vec b$ The magnitude of \\$...
• 21.5k
6k views

### Construct the Identity Matrix

The challenge is very simple. Given an integer input n, output the n x n identity matrix. The identity matrix is one that has <...
• 1,395
1k views

### Cofactor Matrices

The cofactor matrix is the transpose of the Adjugate Matrix. The elements of this matrix are the cofactors of the original matrix. The cofactor (i.e. the element of the cofactor matrix at row i and ...
• 38.7k
1k views

### Construct a companion matrix

You have a number of polynomials who are lonely, so make them some companions (who won’t threaten to stab)! For a polynomial of degree n, there is an ...
• 1,035