## mathmath333 one year ago Find the minimum value of

1. mathmath333

\large \color{black}{\begin{align} |x-1|+|x-2|+|x-3|+\cdots \ \cdots+|x-75|,\ \ x\in\mathbb{R}\hspace{.33em}\\~\\ \end{align}}

2. anonymous

thats a hard one

3. anonymous

maybe -77 ?

4. mathmath333

absolute value is always +

5. anonymous

yes true true

6. perl

I get around 1406

7. mathmath333

how

8. mathmath333

thats right btw

9. perl

that gives you x = 38

10. perl

thats correct

11. ParthKohli

Yeah, I meant 38.

12. ParthKohli

$37\cdot 38 = 1406$

13. perl

mathmath, I used computer software and did it by brute force. not elegantly

14. ganeshie8

38 is the median value of integers 1-75

15. ganeshie8

it works because of symmetry but we need to prove it i guess

16. mathmath333

u did (1+75)/2

17. ParthKohli

$|x - 1| + \cdots + |x - 75|\ge |75x - 75\cdot 38| = 75|x - 38|$Equality occurs at $$x=38$$.

18. ParthKohli

Again, wrong method to do it. =_=

19. mathmath333

what is wrong

20. ParthKohli

The answer is correct, but it's the wrong approach.

21. mathmath333

in case it was this then how we do it \large \color{black}{\begin{align} |x+0|+|x-1|+|x-2|+|x-3|+\cdots \quad \cdots+|x-75|,\ \ x\in\mathbb{R}\hspace{.33em}\\~\\ \end{align}}

22. ParthKohli

This function is continuous and also symmetric about $$38$$, so that is where the minimum should occur as there is no maximum.

23. perl

if you take the derivative of that function it is negative for x < 38 and positive for x > 38

24. ParthKohli

Derivatives with absolute values?

25. mathmath333

i dont know much calculus

26. perl

$$\Large |x| =\sqrt{x^2}$$

27. perl

This is not the optimal approach, maybe a last resort.

28. ParthKohli

Yeah, I think the best way to explain it is $$f(38+k) = f(38 - k)$$

29. mathmath333

i was asking for this edited question do i here also substitute $$38$$ \large \color{black}{\begin{align} |x-0|+|x-1|+|x-2|+|x-3|+\cdots \quad \cdots+|x-75|,\ \ x\in\mathbb{R}\hspace{.33em}\\~\\ \end{align}}

30. imqwerty

we take some cases 1) suppose x=<0 then all the mods will open as negative and we'll get a big number 2) suppose x>=75 then all mods will open positive and in this case we'll get a big number 3)if 0<x<75 then some mods will open positive and some negative nd thus the negative ones and positive ones will cancel each other nd we'll get a smaller value so we take a middle value from the numbers 1-75 i.e (1+75)/2 = 38 then then'll u must be able to solve it

31. imqwerty

yes @mathmath333 u have to put x = 38 in that equation

32. ParthKohli

Observe that $$f(37.5 + k) = f(37.5 - k)$$ so min should occur at $$37.5$$

33. perl

f(37.5) = 1406.5 f(38) = 1406

34. ParthKohli

ooo.

35. imqwerty

plugging x = 38 u get the value of equation as 1406

36. ganeshie8

Nice! just nitpicking on your latest reply OK ;p below is symmetric but the min value occurs somewhere else |dw:1434029538657:dw|

37. mathmath333

but calculated 1406 for previous question adding $$|38-0+(1406) | >1406$$

38. ganeshie8

*PK

39. ParthKohli

Yeah, I saw that $$f(37) = f(38)$$ and somehow came to the conclusion that it should be minimum at $$37.5$$ Sorry abou thtat

40. ParthKohli

My intuition somehow always manages to stay one step behind me.

41. ParthKohli

$f(37) = f(38)$ Scared me for a moment there. I was about to go to sleep.

42. ganeshie8

nope, looks ur intuition works perfectly in present problem!

43. ParthKohli

Nah, I got the $$|x| + |x- 1| + \cdots + |x- 74 | + |x- 75|$$ problem wrong exactly because of the reason you posted.

44. ParthKohli

I have a neat problem about absolute values. Hold on. Gonna post it.

Mathematically can't solve this problem

46. perl

can you generalize the problem find the min of $$\Large \sum_{k=0}^n | x - (a+k)|$$

47. ParthKohli

It depends on the number of terms being odd/even. We covered both cases. In both cases, we see the median.

48. mathmath333

how can i solve this with wolfram

49. perl

it exceeds wolframs computational abilities but the code is https://www.wolframalpha.com/input/?i=Min%5B+Sum%5BAbs%5Bx+-+k%5D%2C+%7Bk%2C+1%2C+75%7D%5D%5D

50. mathmath333

also this is not working https://www.desmos.com/calculator/bpayybqovh

51. perl

using the graph you can estimate that the minimum is between 35 and 40. then plug this number into wolfram manually https://www.wolframalpha.com/input/?i=+Sum%5BAbs%5B37-+k%5D%2C+%7Bk%2C+1%2C+75%7D%5D%5D%2C++Sum%5BAbs%5B38-+k%5D%2C+%7Bk%2C+1%2C+75%7D%5D%5D%2C+Sum%5BAbs%5B39-+k%5D%2C+%7Bk%2C+1%2C+75%7D%5D%5D

52. mathmath333

wait desmos graph gave $$\Large y_{min}=1444$$

53. perl

Hmm

54. perl

Oh you have to zoom out

55. mathmath333

so $$1406+38=1444$$ haha indeed for the second problem $$y=38$$ was correct @imqwerty u were correct indeed

56. perl

just change the code a little bit http://prntscr.com/7fqk52

57. mathmath333

so parthkohli answer of 37.5 was incorrct ?

58. perl

59. perl
60. mathmath333

i m still confused why 38 works on both cases

61. perl

you're talking about the other problem

62. perl

i caught a glimpse of it,

63. mathmath333

for both problem

64. perl

g(x)= sum | x - k | , k=0..75 f(x) = sum | x - k | , k=1..75 agreed?

65. mathmath333

yes

66. perl

g(37) = g(38) = 1444 f(38) = 1406

67. perl

According to my calculations g(37)=g(37.5) = g(38) there is a flat line there http://prntscr.com/7fqoum

68. perl

Therefore it is not wrong to say g(37.5) is the minimum. It is. So is g(37) and g(38)

69. perl

In the case f(x), we have corner , not a flat line, at the minimum.

70. perl

If you zoom in enough

71. mathmath333

how can u prove $$g(37.5)=g(38)$$

72. mathmath333

ok i saw that by zooming .

73. perl

and the other case is this http://prntscr.com/7fqqtn

74. mathmath333

graph shows $$g(37\leq x\leq 38)=same$$

75. perl

I hope that's not too confusing :)

76. perl

Example: {1,2,3,4,5} <--- median is 3 {1,2,3,4} <--- median is 2.5 , the average of 2 and 3

77. mathmath333

actually when the numbers are even like for 1,2,3,4, then median is $$2\leq x\leq 3$$ any value of inequality of x will work

78. perl

yes

79. perl

I am curious did you mean to put a plus sign here or was this a different problem. http://prntscr.com/7fr0o7

80. mathmath333

lol that was typo it should be this \large \color{black}{\begin{align} \left(\sum_{k=0}^{75}|x-k| \right )\hspace{.33em}\\~\\ \end{align}}

81. IrishBoy123

FWIW, in Python x sum of abs's 36.0 1410.0 36.5 1408.5 37.0 1407.0 37.5 1406.5 38.0 1406.0 38.5 1406.5 39.0 1407.0 39.5 1408.5 40.0 1410.0