Summer and Fall classes are open for enrollment. Schedule today!

G
Topic
First Poster
Last Poster
k a June Highlights and 2025 AoPS Online Class Information
jlacosta   0
Jun 2, 2025
Congratulations to all the mathletes who competed at National MATHCOUNTS! If you missed the exciting Countdown Round, you can watch the video at this link. Are you interested in training for MATHCOUNTS or AMC 10 contests? How would you like to train for these math competitions in half the time? We have accelerated sections which meet twice per week instead of once starting on July 8th (7:30pm ET). These sections fill quickly so enroll today!

[list][*]MATHCOUNTS/AMC 8 Basics
[*]MATHCOUNTS/AMC 8 Advanced
[*]AMC 10 Problem Series[/list]
For those interested in Olympiad level training in math, computer science, physics, and chemistry, be sure to enroll in our WOOT courses before August 19th to take advantage of early bird pricing!

Summer camps are starting this month at the Virtual Campus in math and language arts that are 2 - to 4 - weeks in duration. Spaces are still available - don’t miss your chance to have a transformative summer experience. There are middle and high school competition math camps as well as Math Beasts camps that review key topics coupled with fun explorations covering areas such as graph theory (Math Beasts Camp 6), cryptography (Math Beasts Camp 7-8), and topology (Math Beasts Camp 8-9)!

Be sure to mark your calendars for the following upcoming events:
[list][*]June 5th, Thursday, 7:30pm ET: Open Discussion with Ben Kornell and Andrew Sutherland, Art of Problem Solving's incoming CEO Ben Kornell and CPO Andrew Sutherland host an Ask Me Anything-style chat. Come ask your questions and get to know our incoming CEO & CPO!
[*]June 9th, Monday, 7:30pm ET, Game Jam: Operation Shuffle!, Come join us to play our second round of Operation Shuffle! If you enjoy number sense, logic, and a healthy dose of luck, this is the game for you. No specific math background is required; all are welcome.[/list]
Our full course list for upcoming classes is below:
All classes run 7:30pm-8:45pm ET/4:30pm - 5:45pm PT unless otherwise noted.

Introductory: Grades 5-10

Prealgebra 1 Self-Paced

Prealgebra 1
Sunday, Jun 15 - Oct 12
Monday, Jun 30 - Oct 20
Wednesday, Jul 16 - Oct 29
Sunday, Aug 17 - Dec 14
Tuesday, Aug 26 - Dec 16
Friday, Sep 5 - Jan 16
Monday, Sep 8 - Jan 12
Tuesday, Sep 16 - Jan 20 (4:30 - 5:45 pm ET/1:30 - 2:45 pm PT)
Sunday, Sep 21 - Jan 25
Thursday, Sep 25 - Jan 29
Wednesday, Oct 22 - Feb 25
Tuesday, Nov 4 - Mar 10
Friday, Dec 12 - Apr 10

Prealgebra 2 Self-Paced

Prealgebra 2
Monday, Jun 2 - Sep 22
Sunday, Jun 29 - Oct 26
Friday, Jul 25 - Nov 21
Sunday, Aug 17 - Dec 14
Tuesday, Sep 9 - Jan 13
Thursday, Sep 25 - Jan 29
Sunday, Oct 19 - Feb 22
Monday, Oct 27 - Mar 2
Wednesday, Nov 12 - Mar 18

Introduction to Algebra A Self-Paced

Introduction to Algebra A
Sunday, Jun 15 - Oct 12
Thursday, Jun 26 - Oct 9
Tuesday, Jul 15 - Oct 28
Sunday, Aug 17 - Dec 14
Wednesday, Aug 27 - Dec 17
Friday, Sep 5 - Jan 16
Thursday, Sep 11 - Jan 15
Sunday, Sep 28 - Feb 1
Monday, Oct 6 - Feb 9
Tuesday, Oct 21 - Feb 24
Sunday, Nov 9 - Mar 15
Friday, Dec 5 - Apr 3

Introduction to Counting & Probability Self-Paced

Introduction to Counting & Probability
Sunday, Jun 1 - Aug 24
Thursday, Jun 12 - Aug 28
Wednesday, Jul 2 - Sep 17
Sunday, Jul 27 - Oct 19
Monday, Aug 11 - Nov 3
Wednesday, Sep 3 - Nov 19
Sunday, Sep 21 - Dec 14 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Friday, Oct 3 - Jan 16
Tuesday, Nov 4 - Feb 10
Sunday, Dec 7 - Mar 8

Introduction to Number Theory
Monday, Jun 9 - Aug 25
Sunday, Jun 15 - Sep 14
Tuesday, Jul 15 - Sep 30
Wednesday, Aug 13 - Oct 29
Friday, Sep 12 - Dec 12
Sunday, Oct 26 - Feb 1
Monday, Dec 1 - Mar 2

Introduction to Algebra B Self-Paced

Introduction to Algebra B
Wednesday, Jun 4 - Sep 17
Sunday, Jun 22 - Oct 19
Friday, Jul 18 - Nov 14
Thursday, Aug 7 - Nov 20
Monday, Aug 18 - Dec 15
Sunday, Sep 7 - Jan 11
Thursday, Sep 11 - Jan 15
Wednesday, Sep 24 - Jan 28
Sunday, Oct 26 - Mar 1
Tuesday, Nov 4 - Mar 10
Monday, Dec 1 - Mar 30

Introduction to Geometry
Monday, Jun 16 - Dec 8
Friday, Jun 20 - Jan 9
Sunday, Jun 29 - Jan 11
Monday, Jul 14 - Jan 19
Wednesday, Aug 13 - Feb 11
Tuesday, Aug 26 - Feb 24
Sunday, Sep 7 - Mar 8
Thursday, Sep 11 - Mar 12
Wednesday, Sep 24 - Mar 25
Sunday, Oct 26 - Apr 26
Monday, Nov 3 - May 4
Friday, Dec 5 - May 29

Paradoxes and Infinity
Mon, Tue, Wed, & Thurs, Jul 14 - Jul 16 (meets every day of the week!)

Intermediate: Grades 8-12

Intermediate Algebra
Sunday, Jun 1 - Nov 23
Tuesday, Jun 10 - Nov 18
Wednesday, Jun 25 - Dec 10
Sunday, Jul 13 - Jan 18
Thursday, Jul 24 - Jan 22
Friday, Aug 8 - Feb 20
Tuesday, Aug 26 - Feb 24
Sunday, Sep 28 - Mar 29
Wednesday, Oct 8 - Mar 8
Sunday, Nov 16 - May 17
Thursday, Dec 11 - Jun 4

Intermediate Counting & Probability
Sunday, Jun 22 - Nov 2
Sunday, Sep 28 - Feb 15
Tuesday, Nov 4 - Mar 24

Intermediate Number Theory
Sunday, Jun 1 - Aug 24
Wednesday, Jun 18 - Sep 3
Wednesday, Sep 24 - Dec 17

Precalculus
Sunday, Jun 1 - Nov 9
Monday, Jun 30 - Dec 8
Wednesday, Aug 6 - Jan 21
Tuesday, Sep 9 - Feb 24
Sunday, Sep 21 - Mar 8
Monday, Oct 20 - Apr 6
Sunday, Dec 14 - May 31

Advanced: Grades 9-12

Olympiad Geometry
Tuesday, Jun 10 - Aug 26

Calculus
Wednesday, Jun 25 - Dec 17
Sunday, Sep 7 - Mar 15
Wednesday, Sep 24 - Apr 1
Friday, Nov 14 - May 22

Group Theory
Thursday, Jun 12 - Sep 11

Contest Preparation: Grades 6-12

MATHCOUNTS/AMC 8 Basics
Monday, Jun 2 - Aug 18
Thursday, Jun 12 - Aug 28
Sunday, Jun 22 - Sep 21
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)
Sunday, Aug 17 - Nov 9
Wednesday, Sep 3 - Nov 19
Tuesday, Sep 16 - Dec 9
Sunday, Sep 21 - Dec 14 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Monday, Oct 6 - Jan 12
Thursday, Oct 16 - Jan 22
Tues, Thurs & Sun, Dec 9 - Jan 18 (meets three times a week!)

MATHCOUNTS/AMC 8 Advanced
Wednesday, Jun 11 - Aug 27
Sunday, Jun 22 - Sep 21
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)
Sunday, Aug 17 - Nov 9
Tuesday, Aug 26 - Nov 11
Thursday, Sep 4 - Nov 20
Friday, Sep 12 - Dec 12
Monday, Sep 15 - Dec 8
Sunday, Oct 5 - Jan 11
Tues, Thurs & Sun, Dec 2 - Jan 11 (meets three times a week!)
Mon, Wed & Fri, Dec 8 - Jan 16 (meets three times a week!)

AMC 10 Problem Series
Sunday, Jun 1 - Aug 24
Thursday, Jun 12 - Aug 28
Tuesday, Jun 17 - Sep 2
Sunday, Jun 22 - Sep 21 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Monday, Jun 23 - Sep 15
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)
Sunday, Aug 10 - Nov 2
Thursday, Aug 14 - Oct 30
Tuesday, Aug 19 - Nov 4
Mon & Wed, Sep 15 - Oct 22 (meets twice a week!)
Mon, Wed & Fri, Oct 6 - Nov 3 (meets three times a week!)
Tue, Thurs & Sun, Oct 7 - Nov 2 (meets three times a week!)

AMC 10 Final Fives
Monday, Jun 30 - Jul 21
Friday, Aug 15 - Sep 12
Sunday, Sep 7 - Sep 28
Tuesday, Sep 9 - Sep 30
Monday, Sep 22 - Oct 13
Sunday, Sep 28 - Oct 19 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Wednesday, Oct 8 - Oct 29
Thursday, Oct 9 - Oct 30

AMC 12 Problem Series
Thursday, Jun 12 - Aug 28
Sunday, Jun 22 - Sep 21
Wednesday, Aug 6 - Oct 22
Sunday, Aug 10 - Nov 2
Monday, Aug 18 - Nov 10
Mon & Wed, Sep 15 - Oct 22 (meets twice a week!)
Tues, Thurs & Sun, Oct 7 - Nov 2 (meets three times a week!)

AMC 12 Final Fives
Thursday, Sep 4 - Sep 25
Sunday, Sep 28 - Oct 19
Tuesday, Oct 7 - Oct 28

AIME Problem Series A
Thursday, Oct 23 - Jan 29

AIME Problem Series B
Sunday, Jun 22 - Sep 21
Tuesday, Sep 2 - Nov 18

F=ma Problem Series
Wednesday, Jun 11 - Aug 27
Tuesday, Sep 16 - Dec 9
Friday, Oct 17 - Jan 30

WOOT Programs
Visit the pages linked for full schedule details for each of these programs!


MathWOOT Level 1
MathWOOT Level 2
ChemWOOT
CodeWOOT
PhysicsWOOT

Programming

Introduction to Programming with Python
Sunday, Jun 15 - Sep 14 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Tuesday, Jun 17 - Sep 2
Monday, Jun 30 - Sep 22
Thursday, Aug 14 - Oct 30
Sunday, Sep 7 - Nov 23
Tuesday, Dec 2 - Mar 3

Intermediate Programming with Python
Sunday, Jun 1 - Aug 24
Monday, Jun 30 - Sep 22
Friday, Oct 3 - Jan 16

USACO Bronze Problem Series
Sunday, Jun 22 - Sep 1
Wednesday, Sep 3 - Dec 3
Thursday, Oct 30 - Feb 5
Tuesday, Dec 2 - Mar 3

Physics

Introduction to Physics
Sunday, Jun 15 - Sep 14
Monday, Jun 23 - Sep 15
Tuesday, Sep 2 - Nov 18
Sunday, Oct 5 - Jan 11
Wednesday, Dec 10 - Mar 11

Physics 1: Mechanics
Monday, Jun 23 - Dec 15
Sunday, Sep 21 - Mar 22
Sunday, Oct 26 - Apr 26

Relativity
Mon, Tue, Wed & Thurs, Jun 23 - Jun 26 (meets every day of the week!)
0 replies
jlacosta
Jun 2, 2025
0 replies
Easiest geometry in KMO ever
pokmui9909   4
N 28 minutes ago by heheman
Source: KMO 2024 P1
Let there be a circle with center $O$, and three distinct points $A, B, X$ on the circle, where $A, B, O$ are not collinear. Let $\Omega$ be the circumcircle of triangle $ABO$. Segments $AX, BX$ intersect $\Omega$ at points $C(\neq A), D(\neq B)$, respectively. Prove that $O$ is the orthocenter of triangle $CXD$.
4 replies
pokmui9909
Nov 9, 2024
heheman
28 minutes ago
Inversion?
Captainscrubz   3
N 30 minutes ago by Ravensrule8
Source: own
Let $\omega$ be a circle through $O$ and let $A_1 , A_2 ,....., A_n$ be points on $\omega$ . Let $A'_1,A'_2,...,A'_n$ be points such that $A'_i\in OA_i$ for $1\leq i\leq n $ ,$OA'_1A'_2....A'_n$ is cyclic and $\sum_{k=1}^{n}OA_k=\sum_{k=1}^{n}OA'_k$ . Prove that as $A'_1$ moves the circumcircle $(OA'_1A'_2....A'n)$ passes through fixed point.
3 replies
Captainscrubz
Today at 11:15 AM
Ravensrule8
30 minutes ago
Balkan MO 2022/1 is reborn
Assassino9931   9
N an hour ago by LeYohan
Source: Bulgaria EGMO TST 2023 Day 1, Problem 1
Let $ABC$ be a triangle with circumcircle $k$. The tangents at $A$ and $C$ intersect at $T$. The circumcircle of triangle $ABT$ intersects the line $CT$ at $X$ and $Y$ is the midpoint of $CX$. Prove that the lines $AX$ and $BY$ intersect on $k$.
9 replies
Assassino9931
Feb 7, 2023
LeYohan
an hour ago
IMO ShortList 2003, geometry problem 4
orl   47
N an hour ago by lksb
Source: IMO ShortList 2003, geometry problem 4
Let $\Gamma_1$, $\Gamma_2$, $\Gamma_3$, $\Gamma_4$ be distinct circles such that $\Gamma_1$, $\Gamma_3$ are externally tangent at $P$, and $\Gamma_2$, $\Gamma_4$ are externally tangent at the same point $P$. Suppose that $\Gamma_1$ and $\Gamma_2$; $\Gamma_2$ and $\Gamma_3$; $\Gamma_3$ and $\Gamma_4$; $\Gamma_4$ and $\Gamma_1$ meet at $A$, $B$, $C$, $D$, respectively, and that all these points are different from $P$. Prove that

\[
  \frac{AB\cdot BC}{AD\cdot DC}=\frac{PB^2}{PD^2}.
 \]
47 replies
orl
Oct 4, 2004
lksb
an hour ago
No more topics!
Rectangles of grid cells
tapir1729   11
N May 23, 2025 by Mathandski
Source: TSTST 2024, problem 9
Let $n \ge 2$ be a fixed integer. The cells of an $n \times n$ table are filled with the integers from $1$ to $n^2$ with each number appearing exactly once. Let $N$ be the number of unordered quadruples of cells on this board which form an axis-aligned rectangle, with the two smaller integers being on opposite vertices of this rectangle. Find the largest possible value of $N$.

Anonymous
11 replies
tapir1729
Jun 24, 2024
Mathandski
May 23, 2025
Rectangles of grid cells
G H J
G H BBookmark kLocked kLocked NReply
Source: TSTST 2024, problem 9
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
tapir1729
71 posts
#1 • 2 Y
Y by Rounak_iitr, cubres
Let $n \ge 2$ be a fixed integer. The cells of an $n \times n$ table are filled with the integers from $1$ to $n^2$ with each number appearing exactly once. Let $N$ be the number of unordered quadruples of cells on this board which form an axis-aligned rectangle, with the two smaller integers being on opposite vertices of this rectangle. Find the largest possible value of $N$.

Anonymous
This post has been edited 1 time. Last edited by tapir1729, Jun 24, 2024, 9:36 PM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
pikapika007
302 posts
#2 • 1 Y
Y by cubres
400 dollars obtained
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
DottedCaculator
7358 posts
#3 • 3 Y
Y by Batsuh, centslordm, cubres
Count increasing 2-paths which have one edge in each direction.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
awesomeguy856
7265 posts
#4 • 10 Y
Y by YaoAOPS, ayeen_izady, ihatemath123, peace09, OronSH, Sedro, centslordm, EpicBird08, Ubfo, cubres
Answer is $\dfrac{n^4-n^2}{12}.$

Construction is to number complete diagonals in order, such as in the following:
[asy]
for (int i = 0; i < 6; ++i) {
draw((0,i)--(5,i));
draw((i,0)--(i,5)); 
}
label("1",(0.5,0.5));
label("2",(1.5,1.5));
label("3",(2.5,2.5));
label("4",(3.5,3.5));
label("5",(4.5,4.5));
label("6",(0.5,1.5));
label("7",(1.5,2.5));
label("8",(2.5,3.5));
label("9",(3.5,4.5));
label("10",(4.5,0.5));
label("11",(0.5,2.5));
label("12",(1.5,3.5));
label("13",(2.5,4.5));
label("14",(3.5,0.5));
label("15",(4.5,1.5));
label("16",(0.5,3.5));
label("17",(1.5,4.5));
label("18",(2.5,0.5));
label("19",(3.5,1.5));
label("20",(4.5,2.5));
label("21",(0.5,4.5));
label("22",(1.5,0.5));
label("23",(2.5,1.5));
label("24",(3.5,2.5));
label("25",(4.5,3.5));
[/asy]

clarity for later on

To bound this, consider triples of cells such that exactly two are aligned on each axis (basically an L shape of any size and orientation). Call such a triple an elbow if the corner cell of the triple is either larger than or smaller than both the other two cells.

We will bound the number of elbows.

For each cell $c$ in the grid, let $f(c)$ denote the number of cells in its column smaller than it, and $g(c)$ be the number of cells in its row smaller than it.

Then the number of elbows with $c$ as the corner cell is exactly $$f(c)g(c)+(n-1-f(c))(n-1-g(c)).$$
By considering each column, it is clear that the number of times $f(c)=k$ for $0\le k\le n-1$ is exactly $n$ times. (Consider the relative ordering of numbers within each column.) The same is true for $g(c).$

So the total number of elbows over all $c$ is
\begin{align*}
&\sum_c f(c)g(c)+(n-1)^2-(n-1)(f(c)+g(c))+f(c)g(c)\\
&= n^2(n-1)^2-(n-1)\sum_c (f(c)+g(c)) +2\sum_c f(c)g(c)\\
\end{align*}
By rearrangement inequality, this value is maximized when $f(c)=g(c)$ for all $c.$ (This is why equality holds in our maximum construction.)

Thus the maximum number of elbows is exactly
\begin{align*}
&n^2(n-1)^2-(n-1)\cdot(n^2(n-1))+n\cdot\frac{(n-1)n(2n-1)}3\\
&=\frac{n^2(n-1)(2n-1)}3\\
\end{align*}
Now consider the number of rectangles asked for in the problem, and let this be $x.$ Then there are $\binom{n}2^2-x$ nondesired rectangles.

Each of the desired rectangles contains exactly 4 elbows, while the nondesired rectangles contain exactly 2 elbows.

Thus, $$4x+2\left(\binom{n}2^2-x\right)\le\frac{n^2(n-1)(2n-1)}3.$$
So $$x\le\frac{n^2(n-1)(2n-1)}6-\frac{n^2(n-1)^2}4=\frac{n^4-n^2}{12},$$as desired. $\blacksquare$
This post has been edited 2 times. Last edited by awesomeguy856, Jun 24, 2024, 9:55 PM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
ayeen_izady
39 posts
#5 • 1 Y
Y by cubres
@above what a great solution!
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
amuthup
779 posts
#6 • 2 Y
Y by GeoKing, cubres
Call a rectangle $\emph{good}$ if its two smallest integers are on opposite vertices.

Let $M$ be the number of ordered triples of distinct squares $(Q_1,P,Q_2)$ such that $P$ and $Q_1$ are in the same row, $P$ and $Q_2$ are in the same column, the the number in $P$ is less than the numbers in $Q_1$ and $Q_2.$

For each good rectangle, exactly $2$ of its $4$ sets of three consecutive vertices correspond to valid triples. For each non-good rectangle, exactly $1$ does. Thus, $M=2N+\binom{n}{2}^2-N=N+\binom{n}{2}^2.$

On the other hand, the number of triples with a given $P$ is equal to the product of the row "ranking" of $P$ (i.e. the number of squares in its row with greater numbers) and the column "ranking" of $P$ (i.e. the number of squares in its column with greater numbers). Also, exactly $n$ squares have row ranking $i$ for any $0\leq i\leq n-1$, and exactly $n$ squares have column ranking $i$ for any $0\leq i\leq n-1.$ So by the rearrangement inequality, $$M\leq n\cdot 0^2+n\cdot 1^2+\dots+n\cdot (n-1)^2=\frac{n^2(n-1)(2n-1)}{6}.$$
Thus, $$N\leq M-\binom{n}{2}^2=\frac{n^2(n^2-1)}{12}.$$This is constructed by just labeling the diagonals in order.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
IAmTheHazard
5003 posts
#7 • 1 Y
Y by cubres
after many hours of thinking about this problem I have concluded it is absolutely trivial

The answer is $\frac{n^2(n^2-1)}{12}$.

We minimize the number of rectangles that don't work instead. Note that each of these rectangles has exactly two vertices whose values are between their two neighboring vertices', while working rectangles have none. Thus, between any pair of cells sharing a row or column draw an arrow from the smaller to the larger; the number of directed paths $v_1 \to v \to v_2$ is twice the number of bad rectangles.

In each row (resp. column) there's a vertex with "row-indegree" $i$ for all $0 \leq i \leq n-1$, and "row-outdegree" is equal to $n-1$ minus "row-indegree". Let $x_{ij}$ and $y_{ij}$ denote the row and column indegrees of cell $(i,j)$ for $1 \leq i,j \leq n$, so we have $\{x_{ik}\}_k=\{y_{kj}\}_k=\{0,\ldots,n-1\}$ and the quantity we're counting is $\sum_{1 \leq i,j \leq n} x_{ij}y_{ij}+(n-1-x_{ij})(n-1-y_{ij})=\sum_{1 \leq i,j \leq n} (n-1)^2-(n-1)(x_{ij}+y_{ij})+2x_{ij}y_{ij}$. Maximizing this clearly amounts to maximizing $2\sum x_{ij}y_{ij}$ (actually these expressions are equal lmao), which by rearrangement is $n\sum_{i=0}^{n-1} i(n-1-i)=\frac{n^2(n-1)(n-2)}{12}$ (achieved when $x_{ij}+y_{ij}=n-1$), so the quantity we're counting is at least $\frac{n^2(n-1)(n-2)}{6}$ and the number of good rectangles is at most $\frac{n^2(n-1)^2}{4}$ minus this or $\frac{n^2(n^2-1)}{12}$ as desired.

For a construction color by diagonal; it's easy to see that this fits the rearrangement equality case
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
math_comb01
665 posts
#8 • 1 Y
Y by cubres
Very Nice.
We claim that the answer is $n^2(n^2-1)/12$ achieved by diagonal type construction; that is, $1,2, \cdots n$ in center diagonal $n+1,n+2 \cdots$ in the following diagonal and continue in similar fashion.
Let $f(i,j)$ denote the number of cells in row $j$ less than $C_{i,j}$ and similarly we define $g(i,j)$ for columns. Define $L$ to be three cells $C_{i,j},C_{k,j},C_{i,k}$ such that $C_{i,k},C_{i,j},C_{k,j}$ is neither in increasing or decreasing order, we count the number of $L$ in the grid, which evidently equal to $\sum f(i,j)g(i,j)+(n-1-f(i,j))(n-1-g(i,j))$, considering each row/column we know that the number of times $f(i,j)$ appears in $n$, and so the sum becomes $n^2(n-1)^2-(n-1)\sum f(i,j)+g(i,j) + \quad + \sum 2f(i,j)g(i,j)$ which is clearly maximized when all $f(i,j)=g(i,j)$ which gives the same answer as desired.
This post has been edited 1 time. Last edited by math_comb01, Jul 10, 2024, 1:33 AM
Reason: lol?
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Martin2001
170 posts
#9 • 1 Y
Y by cubres
In each row and column, draw an arrow for each pair of squares in the row and and column pointing from large to small. Let the row indegree and the column indegree be the number of arrows pointing to that square in that row and column, respectively. Note that for every rectangle that doesn't work there are exactly $2$ paths in arrows from one corner to another. For a rectangle that works there are obviously none. Therefore we try to minimize the number of paths of length $2$ on the arrows.
Note that in each row each indegree from $0$ to $n-1$ inclusive must be assigned to a square. Same for columns. Let the row indegree and column indegree for an arbitrary square be $a_i,b_i,$ respectively.
Then we are finding the minimum $a_i(n-1-b_i)+b_i(n-1-a_i)=(a_i+b_i)(n-1)-2a_ib_i.$ Summing over all possible $a_i,b_i$ for all rows is obviously $2\cdot n\cdot \frac{n(n-1)}{2},$
so the first term is $n^2(n-1)^2.$ As we want to maximize the sum of all $a_ib_i,$ by the rearrangement inequality we have that the maximum is when all $a_i=b_i.$
As this is $n$ times the sum of squares from $1$ to $(n-1)^2,$ which is $\frac{(n^2(n-1)(2n-1))}{6}.$ Therefore by subtracting $\frac 12(n^2(n-1)^2-\frac{(n^2(n-1)(2n-1))}{3})$ from $\frac{n^2(n-1)^2}{4},$ our answer is $$\boxed{\frac{n^2(n-1)(n+1)}{12}}.$$Construction is just having the smallest $n$ numbers be on the diagonal from lower left to top right, the next $n$ numbers being on the smaller diagonal to the immediate left of that main diagonal and the lower right corner, the next $n$ numbers being on the next diagonal to the immediate left of the previous diagonal and the remaining numbers not fitting in that diagonal on the diagonal on the immediate left of that lower right corner, and so on$.\blacksquare$
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
N3bula
304 posts
#10 • 1 Y
Y by cubres
I claim the answer is $\frac{n^4-n^2}{12}$, for a cell $k$ let $f(k)$ denote the coloumn indegree and $g(k)$ denote the row indegree, and let $C$ be the
set of cells, than the number of rectangles which are not of the form is at least half the number of bend shapes which are increasing. This is equal to:
\[\sum_{i\in C}(n-f(i)-1)g(i)+(n-g(i)-1)f(i)\]Which by rearrangement inequality is minimsed when $f(i)=g(i)$, thus giving us our minimum.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
HamstPan38825
8890 posts
#11 • 1 Y
Y by cubres
Really beautiful and perfectly placed at #9. The answer is $\frac 1{12} n^2(n+1)(n-1)$ rectangles.

Proof of Bound: We consider pivots, or cells $a, b, c$ such that $a$ and $b$ share a row, $b$ and $c$ share a column, and $b > a$ and $b>c$.

Claim: There are at most $\frac 16n^2(n-1)(2n-1)$ pivots.

Proof: For each cell $(i, j)$, denote by $a_{ij}$ the number of cells in the same row as $(i, j)$ with lesser value, and denote $b_{ij}$ to be the same number for the column. The number of pivots is given by the sum of $a_{ij}b_{ij}$ across all cells $(i, j)$. Observe that for any index $i$,
\[\{a_{i1}, a_{i2}, \dots, a_{in}\} = \{0, 1, 2, \dots, n-1\} = \{b_{i1}, b_{i2}, \dots, b_{in}\}\]so by the Rearrangement inequality,
\[\sum_{j=1}^n a_{in}b_{in} \leq \sum_{j=1}^n j^2 = \frac 16n(n-1)(2n-1).\]Summing across all columns yields the result. $\blacksquare$

Suppose that there are $x$ rectangles that satisfy the condition. Then among the vertices of each of these $x$ rectangles, we can find exactly two pivots; conversely, among the vertices of any of the $y$ remaining rectangles, we can find precisely one pivot. If there are $P$ pivots, it follows that
\begin{align*}
x &= (x+2y) - (x+y) = P - {n \choose 2}^2 \\
&\leq \frac 16n^2(n-1)(2n-1) - \frac 14 n^2(n-1)^2 = \frac 1{12} n^2(n+1)(n-1)
\end{align*}as required.

Construction: We just need the bound in the claim to be tight. A valid construction (among many) is to take the number in position $(i, j)$ to be $i + n(j-i) \pmod {n^2}$; see the $n=5$ case as an illustration:
\[\begin{tabular}{ccccc}
1 & 6 & 11 & 16 & 21 \\
22 & 2 & 7 & 12 & 17 \\
18 & 23 & 3 & 8 & 13 \\
14 & 19& 24 & 4 & 9 \\
10 & 15 & 20 & 25 & 5
\end{tabular}\]
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Mathandski
775 posts
#13 • 1 Y
Y by cubres
Posting for storage Subjective Difficulty Rating
Attachments:
This post has been edited 1 time. Last edited by Mathandski, May 23, 2025, 11:54 PM
Z K Y
N Quick Reply
G
H
=
a