# Gyan Room - Algebra - Concepts & Shortcuts

• How many Integral Solution : |x-7| + |y| < = 10 , y > = 0

Method 1 :

|x - 7| + |y | < = 10
let x - 7 > = 0
x - 7 + y < = 10
so x + y < = 17
here x > = 7
so put x = 7 + a
so 7 + a + y < = 17
so a + y < = 10
so when a = 0 then y < = 10 so 11 values
when a = 1 then y < = 9 so 10 values
.
.
when a = 7 then 4 values
when a = 8 then y < = 2 so
when a = 9 then y < = 1
so 2 values

when a = 10 then y < = 0 so 1 values
1 + 2 + 3 ... 11 = 11 * 6 = 66 values

now when 0 < = x < = 6
so -x + 7 + y < = 10
so -x + y < = 3
y - x < = 3
so y < = x + 3
so when x = 0 then y < = 3 so 4 values
when x = 1 then 5 values
tlll x = 6 where 10 values
so 4 + 5 + 6 + 7 + 8 + 9 + 10 = 49
now when x < 0
so - x + 7 + y < = 10
so - x + y < = 3
so y < = x + 3
when x=-1 then y < = 2 so 3 values
when x=-2 then y < = 1 so 2 values
x= -3 y < = 0 so 1 values so 6 value total
66 + 49 + 6 = 66 + 55 = 121 values

Method 2 = |x - 7| + |Y| + k =10
12c2= 66
as |x - 7| can take -ve values 66 * 2 = 132
now subtract cases when x - 7 = 0 so |y| < = 10 so 11 values will be removed so 132 - 11 = 121

Method 3: • If a + b + c + d = 20, how many unique, non-negative integer solutions exist for (a, b, c, d)?

Let us try and understand the concept behind solving such questions.

This is like distributing 20 identical chocolates between 4 kids A, B, C, and D. You arrange these 20 chocolates in a line

C C C C … C

Now, you put in partitions in between them. Let me denote the partitions with P

C C C P C P C C C C C P C C C C C C C C C C C

A gets the chocolates before the first partition, B gets the chocolates between the first two partitions, C gets the chocolates between the second and the third partition and D gets the chocolate after the third partition. In the arrangement shown above A gets 3 chocolates, B gets 1, C gets 5, and D gets 11. Any rearrangement of the above, will lead to a new distribution of chocolates.

The above can be rearranged in 23! / 20! 3! We got this because there are a total of 23 entities out of which 20 Cs are identical and 3 Ps are identical.

Now, to extend this concept, what if we have to distribute ‘n’ chocolates in ‘r’ kids. After putting the n chocolates in a line, we would need r - 1 partitions. This would mean that there will be a total of n+r-1 entities out of which n would be identical (of one type) and the other r - 1 would be identical as well (of another type). So, the number of ways in which that would be possible = (n + r - 1)! / n! (r-1)!

This, in other words, is (n + r - 1) C (r - 1)

And now, we can use this formula to solve any similar questions

a + b + c + d = 20

Case 1: a, b, c, d are non-negative integers.

Number of solutions = (20 + 4 - 1) C (4 - 1) = 23 C 3 = 1771

Case 2: a, b, c, d are positive integers

We allocate at least a value of 1 to a, b, c, d.

So, we can say a = a’ + 1, b = b’ + 1, c = c’ + 1, d = d’ + 1 where a’, b’ c’, d’ are non-negative integers

=> a’ + 1 + b’ + 1 + c’ + 1 + d’ + 1 = 20

=> a’ + b’ + c’ + d’ = 16

=> Number of solutions = (16 + 4 - 1) C (4 - 1) = 19 C 3

Case 3: a, b, c, d are non-negative integers such that a > 5 and b > 2

We allocate at least a value of 5 to a and 2 to b

So, a = a’ + 5 and b = b’ + 2

=> a’ + 5 + b’ + 2 + c + d = 20

=> a’ + b’ + c + d = 13

=> Number of solutions = (13 + 4 - 1) C ( 4 - 1) = 16 C 3

Case 4: a, b, c, d are non-negative integer such that a > b

Let us first consider the situation where a = b

If a = b = 0, c + d = 20. This has 21 solutions

If a = b = 1, c + d = 18. This has 19 solutions

If a = b = 2, c + d = 16. This has 17 solutions

.

.

If a = b = 10, c + d = 0. This has 1 solution

So, the total number of a solutions when a = b is 21 + 19 + 17 … + 1 = 11/2*(21 + 1) = 121

We know that the number of solutions when a, b, c, and d are non-negative integers is 1771. Out of these 1771 cases, in 121 cases a = b.

So, in 1771 - 121 = 1650 cases a is not equal to b.

In half of the above cases a will be greater than b whereas in the other half of the cases a will be less than b.

So, number of solutions where a > b is 1650/2 = 825

• Equation type: Ax + By = C

Few rules to find integral solutions of this type of equations.

First, reduce the equation in lowest reducible form.
After reducing, if coefficients of x and y still have a common factor, the equation will have no solutions.
If x and y are co-prime in the lowest reducible form, find any one integral solution. The rest of the solutions can be derived from that integral solution.
For each successive integral solutions of the equation, the value x and y will change by a coefficient of the other variable .If the equation is of the type Ax – By=C (after getting the lowest reducible form) ,an increase in x will cause increase in y .If the equation is of the type Ax + By=C,an increase in x will cause a decrease in y.

Let us take an example.

2x + 3y = 39.

Step-1.The equation is already in its reduced form and we can see that coefficients of x and y are co-prime.

Step-2.For a given equation, you should start substituting values (by hit and trial) for the variable that has larger coefficient to find out first integral solution. In this case, it is y. Now, if we take y = 0, we will get x = 39/2(not an integer). Again, if we take y=1, we will get x = 18. So, (18,1) is our first solution.

Step-3.If you understand the 4th point mentioned above, at one of any two consecutive integral values of y, the value of x will come out to be an integer OR at one of the 3 consecutive values of x, the value of ywill come out to be an integer. That means, if we add 2n (where n is an integer) to the first value for y, we will have to subtract 3n from the first value of x to get integral solutions. That means,
If y =1 +2(1) = 3 , x= 18-3(1) = 15.
If y= 1 + 2(2) = 5, x= 18 – 3(2) = 12.
If y= 1 + 2(3) = 7, x = 18 – 3(3) = 9 and so on.

Step-4.This equation will have infinite number of integral solutions but finite number of non-negative integral solutions. Let’s see how we can find it.

We can keep increasing the value of y in the positive direction but x will be decreasing simultaneously and become less than 0 at one point. As lowest non negative integral value of y is 1,highest allowable positive value of x is 18 and it is decreasing by 3. So, x can take 7 non negative integral values and they are- 18, 15, 12, 9, 6, 3 and 0.Hence the given equation has 7 non negative integral values.

Note: In equation Ax + By = C, if C is divisible by any of A or B, then number of non-negative integral solutions = {C/LCM(A,B)} + 1

• Equation type: |x| + |y| = n

Let |x| = p and |y| = q, then positive integral solutions= n-1C2-1= n-1.
Now, for each solution (x1,y1), there would exist 4 values for x and y, They are ->
(x1,y1), (-x1,y1), (x1,-y1) and (-x1,-y1).
Therefore, total number of positive integral solutions = 4(n-1).

• Type 1 : |x| + |y| = n
Total solutions = 4n.

Example : |x| + |y| = 5.
Total solutions = 4 x 5 = 20.

Type 2 : |x| + |y| + |z| = n.
Total solutions = 4n^2 + 2.

Example : |x| + |y| + |z| = 15.
Total solutions = 4 x 15^2 + 2 = 902.

Type 3 : |x| + |y| + |z| + |w| = n.
Total solutions = (8/3)n(n^2 +2).

Example : |x| + |y| + |z| + |w| = 9.
Total solutions = (8/3) x 3 x (3^2 +2 )
= 8 x 11
= 88.

Type 4 : ax + by = n.
Non negative solutions = n/LCM (a,b) + 1. if either a or b is divided by n.
For positive solutions just remove x=0,y=0 from non negative solution.

Example : 2x + 3y = 30.
positive integral solutions
= 30 / LCM (2,3) - 1
= 5 - 1 = 4.

• Type : a x b = N
no of positive solution = no of factors of N.
no of integrated solution =2 x no of factors of N.

Example : a x b = 36.
36 = 2^2 x 3^2.
total no of factors = (2+1)(2+1) = 9.
positive solution = 9.
total solution = 2 x 9 = 18.
Here multiply by 2 because even negative sign also contains in total solution.

• Credits : Indrajeet Singh, iQuanta

Tricks:

1. Summation of the series 1/1 + 1/2 + 1/3 …. + 1/x = ?
It’s summation is kind of difficult to find and not known to many . So engineers can just integrate 1/x from 1 to x
So ∫1/x = ln(x) (Log base e )
So your summation of HP 1/1 + 1/2 + 1/3 …+ 1/x = lnx.
You guys just remember the final result

2. First digit of a number , yes first digit not last which everyone knows .
If we need to find the first digit of a number N , then first find the value of {logN}, let’s say equal to “m” , where {x} is the fractional part of the function. Then the first digit will be given by 10^m .
For example first digit of 3^53 :
{Log3^53} = {53log3} = 0.28
So first digit is 10^0.28 = 1.
Here is how to calculate 10^0.28.
We know 10^log2 = 2, and log2 = 0.3
So 0.28 < 0.3, hence 10^0.28 = 1.x..
Hence first digit = 1.
(Here is how to calculate 10^0.28.
We know 10^log2 = 2, and log2 = 0.3
So 0.28 < 0.3, hence 10^0.28 = 1.x.. Hence first digit = 1)

3. Total numbers such that sum of factorial of their digits = Number itself Only 4 such numbers are there in the number system . a) 1!=1 b) 2!=2 c) 1!+4!+5!=145 d) 4!+0!+5!+8!+5! = 40585

4. 1 * 1! + 2 * 2! + 3 * 3+ ….n * n! = (n+1)! -1
Many might know this but few find hard to get it’s derivation => (2-1) * 1! + (3-1) * 2! +…. (n + 1 - 1)n!
=> 2 * 1! – 1! + 3 * 2! – 2! + 4 * 3! -3! …. (n+1)n! – n!
=> 2! – 1! + 3! – 2! + 4! – 3! +. .. (n+1)! – n!
Observe the pattern.
So all the terms gets cancelled except first and last term So just left with (n+1)! – 1.

5. Number of primes between
1 – 30 => 10 primes
1 – 50 => 15 primes
1 – 100 => 25 primes
1 – 200 => 46 primes
1 – 1000 => 168 primes
Also
1001 = 13k ( multiple of 13)
1003 = 17k ( multiple of 17)
1007 = 19k ( multiple of 19)
So 1009 is the smallest 4 digit prime.

6. Number of positive integral solutions for a/x + b/y = 1/n is the factors of a * b * n^2
And integral solutions = 2 (factors of a * b * n^2) -1
Ex : positive integral solutions of 2/x + 3/y =1/7 is factors of 2 * 3 * 7^2 => 2 * 2 * 3 = 12
And integral solutions is 2 * 12 – 1 = 23 .
Explanation :
2/x + 3/y = 1/7
=> 14y + 21x – xy = 0
=> y(14-x) + 21x = 0
=> y(14-x) + 21x -14 * 21 = – 14 * 21
=> y (14-x) – 21(14-x) = – 14 * 21
=> (x-14)(y-21) = 14*21= 2 * 3 * 7^2
=> a * b = 2 * 3 * 7^2,
So it’s just to find in how many ways the number 2 * 3 * 7^2 can be represented as product of two numbers which is = number of its factors . Hence the formula.

7. Concept : A number to be written as sum of two squares : x^2 + y^2 = N
It will have integer solns only if N contains primes of the form 4k+1 type.
( it means 11, 33, 94 etc type numbers can’t be represented as sum of squares but 5^3 * 13, 17 * 37^2 can be represented )
If all primes are 4k+1 type Then positive solns => number of factors of N,
Number of positive solutions of x^2 + y^2 = 5^3 * 13^2 is 4 * 3 = 12
If it contains some 4k+3 primes with odd power then number of solutions will be 0.
If it contains even powers of 4k+3 primes, then positive solns = number of factors of 4k+1 form only.
Integral solns = 4 * positive solns.
( there are a bit more complications when the number is a perfect square, which you can know by joining the I quanta course )

8. The number of ways of distributing 6 distinct rings in 4 fingers isn’t 4^6.
Most people do this way including few standard text books . But r^n is wrong here .
We apply r^n in case of balls and boxes where internal arrangement inside a box doesn’t matter while in a finger the internal arrangement of ring matters and hence we can’t apply r^n .
So how to solve ? First distribute 6 rings into 4 groups then arrange .
a + b + c + d = 6, => (6+4-1)C (4-1) = 9C3
Now arrange 6 rings in 6! Ways hence your answer is 9C3 * 6!

• a/x + b/y = 1/k where a, b and k are positive integers and we want number of value of (x,y) satisfying this equation
Approach -
First find number of factors of a * b * k^2
let number of factors = M
a) total number of positive integral solutions = M
b) total integral solutions = 2 * M - 1
c) Total number of negative solution= zero (if both x and y will be negative than lhs will be negative but rhs is positive so not possible )

• Area bounded by the curves |ax +/- m | = p and |by +/- n| = q is 4pq/ab sq units
Area bounded by |ax +/- m| + |by +/- n| = k is 2k^2/(ab)
Area bounded by |ax + by| = k and |ax - by| = k is 2k^2/ab
Area bounded by |ax + by| + |ax - by| = k is k^2/(ab)

For detailed explanation - refer https://www.mbatious.com/topic/922/area-of-the-region-bounded-by-the-curves-concepts-shortcuts

• A quadratic function f (x ) = ax^2 + bx + c, can be expressed in the standard form : a(x-h)^2 + k
by completing the square. The graph of f(x) is a parabola with vertex (h,k); the parabola opens upward if a > 0 or downward if a < 0.

Maximum or Minimum Value of a Quadratic Function

Let f be a quadratic function with standard form f (x) = a( x − h )^2 + k.
The maximum or minimum value of f occurs at x = h
If a > 0, then the minimum value of f is f(h) = k.
If a < 0, then the maximum value of is f (h) = k

We now derive a formula for the maximum or minimum of the quadratic function
F(x) = ax^2 + bx + c.
For either of the two cases (the quadratic having a maxima or a minima), the maxima or the minima,
as the case may be, will occur when x = - b/2a
the maximum or minimum value is f(-b/2a) = c - b^2/4a
remember that - b/2a = sum of roots/2

1

1

1

1

1

2

1

2