All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Absolute Value Muse (Posted on 2014-02-19)
Determine the number of integer solutions to:
|x|+ |y| + |z| = 15

Note:

The absolute value function F(x) = |x| is defined as:
```        x if x ≥ 0
F(x) =
-x if x < 0
```

 No Solution Yet Submitted by K Sengupta Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 General Solution -- Two geometric methods | Comment 2 of 4 |
Let's solve the general case.

|x| + |y| = n geometrically is the number of integral points on the edge of a diamond whose 4 vertices are (0,+/- n) and (+/- n, 0).
This equals 4n, unless n = 0, in which case it equals 1.

|x| + |y| + |z| = n geometrically is the number of integral points on the surface of an octahedron whose 6 vertices are (0,0,+/- n) and (0, +/- n, 0) and (0,0, +/- n).

Let's count these two different ways.

Method 1: let's slice the octahedron parallel to the xy plane into one slice of for each possible z value (from -n to n) and sum them up.
Total points, if n > 0 = 1 + 4*1 + 4*2 + ... + 4(n-1) + 4(n) + 4(n-1) + ...+ 4*2 + 4*1 + 1.
this equals 2 + 8*(1 + 2 + ... + (n-1)) + 4n =
2 + 8*(n-1)*n/2 + 4n = 4n^2 + 2.  This is a very cool result.

When n = 15, this equals 902, which is Charlie's number, so I assume that we were both right.

Method 2:  Count the points on the octahedron directly.

First, count points on the 8 triangular faces, not counting the edges.
These equal 8*(1 + 2 +...+ (n-2)) = 4n^2 - 12n + 8

Next, count points on the 12 edges, not counting the vertices.
this is 12*(n-1) = 12n - 12

Next count the 6 vertices.

Total = (4n^2 - 12n + 8) + (12n - 12) + 6 = 4n^2 + 2.
Of course, this is only valid if n > 0

Full general case:
n = 0      Solutions = 1
n > 0      Solutions =  4n^2 + 2

 Posted by Steve Herman on 2014-02-19 19:06:26

 Search: Search body:
Forums (0)