Filling an Array with 0s and 1s - and Counting

The applet below serves an interactive tool to experiment with the following problem:

Fill an N×M array with 0s and 1s. Count the number of 1s in every row and in every column. How many distinct sums are there? What is the possible maximum of distinct sums?

(For the 10×19 matrix the problem has been offered at the 1993-1994 St. Petersburg Regional Mathematical Olympiad, Grade 10.)

Clicking on a number in the array changes 0 to 1 and vice versa. At the bottom of the applet, all distinct sums are collected into a set (note the curly braces) and the number of elements in the set (note the vertical bars) is shown on the right.


This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at http://www.java.com/en/download/index.jsp, download and install Java VM and enjoy the applet.


Buy this applet
What if applet does not run?

An investigation

|Contact| |Front page| |Contents| |Algebra| |Store|

Copyright © 1996-2012 Alexander Bogomolny

Fill an N×M array with 0s and 1s. Count the number of 1s in every row and in every column. How many distinct sums are there? What is the possible maximum of distinct sums?


This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at http://www.java.com/en/download/index.jsp, download and install Java VM and enjoy the applet.


Buy this applet
What if applet does not run?

First, let's observe that neither row nor column sums change if we exchange a pair of rows or a pair of columns. One consequence of this remark is that placing the 1s in an orderly fashion does not cause any loss of generality.

Assume N ≥ M. Our second observation is that the maximum number of distinct sums could not exceed N + 1. Indeed no sum could be greater than N. So the best we may expect to do is to get the sums 0, 1, ..., N-1, N, and there are N + 1 of them.

One can get N + 1 distinct sums when N = M or N = M + 1 (the latter with M ≥ 2):

filling a rect array with 0s and 1s - and counting

The maximum of N + 1 distinct sums is also attainable for N even and M ≥ N/2 + 1 or for N odd and M > (N + 1)/2..

Two distributions of 0s and 1s are complementary if one is obtained from the other by replacing 0s with 1s and 1s with 0s. When N = M, the complement of an optimal distribution is also optimal.

|Contact| |Front page| |Contents| |Algebra| |Store|

Copyright © 1996-2012 Alexander Bogomolny

 41143663

A math books store at a unique math study site. Shopping at the store helps maintain the site. Thank you.
Sites for teachers
Sites for parents
Terms of use
Awards
Interactive Activities

CTK Exchange
CTK Wiki Math
CTK Insights - a blog
Math Help
Games & Puzzles
What Is What
Arithmetic
Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
Stories for Young
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
Visual Illusions
My Logo
Math Poll
Cut The Knot!
MSET99 Talk
Old and nice bookstore
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Sites for parents

Education & Parenting

Search:
Keywords:

Google
Web CTK
Supported by
3wVentures